开发者

How to check if webpage page is scrolled? [duplicate]

开发者 https://www.devze.com 2023-01-04 13:21 出处:网络
This question already has answers here: How do I determine height and scrolling position of window in jQuery?
This question already has answers here: How do I determine height and scrolling position of window in jQuery? (5 answers) Closed 8 years ago.

Is there any way in javascript to check if web page has been vertically scrolled? specially for Internet Explorer? I need to get the mouse position in IE but using jQuery event e.pageY it gives correct value when page is not scr开发者_运维知识库olled but when page is scrolled down then it gives wrong position.


In case any future googlers find this, the quick example is:

if(!$(window).scrollTop()) { //abuse 0 == false :)
  alert("You are at the top of this window");
}


Check out this question if you are comfortable with using jQuery:

How do I determine height and scrolling position of window in jQuery?

0

精彩评论

暂无评论...
验证码 换一张
取 消