Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the jQuery equivalent for pageYOffset?

Tags:

jquery

I have the following code:

window.pageYOffset

What is the jQuery equivalent to pageYOffset?

like image 872
Pota Onasys Avatar asked Dec 04 '15 16:12

Pota Onasys


People also ask

What is pageYOffset in Javascript?

The read-only Window property pageYOffset is an alias for scrollY ; as such, it returns the number of pixels the document is currently scrolled along the vertical axis (that is, up or down) with a value of 0.0, indicating that the top edge of the Document is currently aligned with the top edge of the window's content ...

Is pageYOffset deprecated?

According to MDN, the pageXoffset and pageYoffset is not deprecated.


1 Answers

You can use $(window).scrollTop(), This returns an integer.

The API documentation is here

like image 151
Kaspar Lee Avatar answered Oct 07 '22 03:10

Kaspar Lee