fix: getBoundingClientRect() for reliable scroll progress
This commit is contained in:
@@ -81,8 +81,9 @@ export default function CloudRevealSection() {
|
||||
|
||||
let rafId: number
|
||||
const loop = () => {
|
||||
const rect = section.getBoundingClientRect()
|
||||
const totalHeight = section.offsetHeight - window.innerHeight
|
||||
const scrolled = window.scrollY - section.offsetTop
|
||||
const scrolled = -rect.top
|
||||
const progress = Math.max(0, Math.min(1, scrolled / totalHeight))
|
||||
|
||||
const targetIdx = Math.min(
|
||||
|
||||
Reference in New Issue
Block a user