views:

52

answers:

2

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.

+2  A: 

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

http://stackoverflow.com/questions/303767/how-do-i-determine-height-and-scrolling-position-of-window-in-jquery

Peter Jaric
thanks a lot. my problem is solved. i just need $(window).scrollTop.
Muzzammil Hussain
How about an upvote then? :) And if my link led you to the answer, maybe you could check the accepted check mark?
Peter Jaric
@snowlord - He can't upvote, not enough rep yet :) Though I can, +1.
Nick Craver
@Nick: lol, thanks :)
Peter Jaric
+2  A: 

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");
}
Nick Craver
Re+1 from me...
Peter Jaric