Tuesday, December 1, 2009

[jQuery] jQuery Scrollbar position

Hi,

I am trying to find out the current position of the scrollbar inside
the scroll event of the browser window using jQuery. But there seems
to be a problem.

This is the code.

$(window).scroll(function(){ var asd = $(window).scrollTop();
alert(asd);
});

No alerts appear. But if I remove the $(window).scrollTop() and make
the variable asd a simple string, I can see the alert.

What am I doing wrong here?

No comments: