Home > Article > Web Front-end > How to determine the distance between the document and the top of the browser_jquery
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.