Why is document.body.scrollTop always 0 in IE, even when scrolling?

Mary-Kate Olsen
Release: 2024-11-17 07:52:03
Original
472 people have browsed it

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;
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template