Reputation: 2047
How to detect if a user rolled the bar a certain distance?
I want to trigger an event when user lower the bar in 1000px. thanks.
Upvotes: 0
Views: 3872
Reputation: 41605
Using the scroll
event combined with scrollTop
function:
//when scrolling...
$(window).scroll(function() {
//if I scroll more than 1000px...
if($(window).scrollTop() > 1000){
//do whatever
}
});
Living demo: http://jsfiddle.net/NvfBc/
Upvotes: 6