window.pageYOffset

JavaScript1.2+, JScript3+ Nav4+, IE4+ Syntax

							window.pageYOffSet

Description

The pageYOffSet property of the Window object reflects the current vertical pixel location of the top-left corner of the document in the window. In chromeless windows, this property can be referenced if you are moving a window with the moveTo() method before the actual move is made to see if the window needs to be moved. It is also useful when using the scrollTo() method because it returns the current location of the viewable document in relation to the whole page.

Example

Listing 7.568 has a button that, when clicked, displays the current x-and y-coordinates of the window.

Listing 7.568 Using the pageYoffSet Property to See the Current Location ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.