JS-scroll
scroll property
Attributes | |
---|---|
scrollWidth / scrollHeight | Get the scroll bar elements with width / height |
scrollTop / scrollLeft | Get top / left beyond the element portion |
body compatibility problems
Body of compatibility issues scrollTop / scrollLeft, in addition to other elements of the body without compatibility problems
When a document with no DTD declaration:
document.body.scrollTop
document.body.scrollLeft
When the document has a DTD declaration:
document.documentElement.scrollTop
document.documentElement.scrollLeft
Written ignore DTD declaration (Google, Firefox, IE9 + support):
window.pageYOffset
window.pageXOffset
Compatibility writing:
window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop