window.pageXOffset

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

							window.pageXOffSet

Description

The pageXOffSet property of the Window object reflects the current horizontal 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.567 has a button that, when clicked, displays the current x-and y-coordinates of the window.

Listing 7.567 Using the pageXoffSet Property to See the Current ...

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.