'How can i get Y position in all the website page

I have a website which is 6 viewports height. I would like to get the Y position for no matter where i am in the page not only the viewport. I have tried :

  • event.pageY ;
  • element.getBoundingClientRect();
  • window.innerHeight / outerheight;

It doesn't solve my problem.

Thanks



Solution 1:[1]

thanks Alexei Petrenko but it calculates an element position. But I fix my problem with "window.scrollY" that take the number of pixel from the top.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ubobby