Home > Web Front-end > JS Tutorial > How to determine the distance between the document and the top of the browser_jquery

How to determine the distance between the document and the top of the browser_jquery

WBOY
Release: 2016-05-16 17:04:44
Original
1095 people have browsed it

When I was writing code today, I subconsciously used $("body").scrollTop();

and then I found out when I tested it that it didn't work in IE.

I have encountered this problem before, but I remember it seemed to be solved using $("html").scrollTop();. This time I found that it didn't work either.

After looking online, I found that I should use $(window).scrollTop(); or $(document).scrollTop();

to record it. . I recently read "Javascript Advanced Programming" and found that these things related to distance are very different in various browsers.

I don’t feel this way until I use jQuery.

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template