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

亡梦爱人 提交于 2019-12-08 16:10:02

问题


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 scrolled but when page is scrolled down then it gives wrong position.


回答1:


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

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




回答2:


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");
}


来源:https://stackoverflow.com/questions/3074802/how-to-check-if-webpage-page-is-scrolled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!