Outline
Attributes | effect |
---|---|
scrollTop、scrollLeft | It is wound on to, from the left side of |
scrollWidht、scrollHeight | The actual width and height of itself, not including the border |
Page rolled go the distance
- By window.pageXOffset, window.pageYOffset, to obtain the volume of the left side of the page is, from the upper side
- After use IE9 code solve the compatibility problem as follows
function getSCroll() {
return {
left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
top : window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
}
}
Claimed document.documentElement DTD used, not declared by document.body
return the left and top in the form of an object, the object is by using the properties, such as getScroll (). Left