How to get correct values from getBoundingClientRect if page is scrolled on initial load

95 Views Asked by At

So have experienced a small issue with getBoundingClientRect and im not sure how to work around.

If i retrieve the initial Values of an Elements getBoundingClientRect i get correct rect.top and rect.y values. But if i scroll down the Page, reload and then retrieve the Values, the rect.top and rect.y values are now different, they represent the y position from new Page start Position.

Does anyone know a working workaround?

0

There are 0 best solutions below