Window pageXOffset and pageYOffset Properties
Scroll the content by 100 pixels, and alert the pageXOffset and pageYOffset:
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.
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.
|Return Value:||The number of pixels that the document has already been scrolled from the upper left corner of the window, horizontally and vertically|
Thank You For Helping Us!
Your message has been sent to W3Schools.