Home > Article > Web Front-end > Why is document.body.scrollTop always 0 in IE, even when scrolling?
document.body.scrollTop in IE is always 0, even when scrolling
When you move the mouse, in the status bar Display the value of document.body.scrollTop. In IE, this value is always 0. Why is it always 0? Is there any other way to get how much the scrollbar has moved?
To resolve this issue, for older document types in IE, you can try the following:
var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
The above is the detailed content of Why is document.body.scrollTop always 0 in IE, even when scrolling?. For more information, please follow other related articles on the PHP Chinese website!