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

  • 2020-03-30 01:18:13
  • OfStack

$("body").scrolltop ();

Wait for the test only to find that in IE does not work.

I've touched on this before, but I think I used $(" HTML ").scrolltop (); To solve. The discovery didn't work.

Then I looked on the Internet and found that I should use $(window).scrolltop (); Or the $(document). ScrollTop ();

Write it down. Recently, I looked at Javascript advanced programming and found that these things related to distance are too different from browser to browser.

I've never felt that way with jQuery.

Related articles: