HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Window pageXOffset and pageYOffset Properties

Window Object Reference Window Object

Example

Scroll the content by 100 pixels, and alert the pageXOffset and pageYOffset:

window.scrollBy(100,100);
alert("pageXOffset: " + window.pageXOffset + ", pageYOffset: " + window.pageYOffset);

Try it yourself »

Definition and Usage

The pageXOffset and pageYOffset properties returns the pixels the current document has been scrolled from the upper left corner of the window, horizontally and vertically.

The pageXOffset and pageYOffset properties are equal to the scrollX and scrollY properties.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The pageXOffset and pageYOffset properties are supported in all major browsers.

Note: IE 8 and earlier does not support this property, but may use "document.body.scrollLeft" and "document.body.scrollTop" instead.


Syntax

window.pageXOffset
window.pageYOffset

Technical Details

Return Value: The number of pixels that the document has already been scrolled from the upper left corner of the window, horizontally and vertically


Window Object Reference Window Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE