fix: getBoundingClientRect() for reliable scroll progress

This commit is contained in:
2026-07-31 00:05:18 +03:00
parent 37d37b44b0
commit 648c410953
+2 -1
View File
@@ -81,8 +81,9 @@ export default function CloudRevealSection() {
let rafId: number let rafId: number
const loop = () => { const loop = () => {
const rect = section.getBoundingClientRect()
const totalHeight = section.offsetHeight - window.innerHeight 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 progress = Math.max(0, Math.min(1, scrolled / totalHeight))
const targetIdx = Math.min( const targetIdx = Math.min(