I want to use jQuery to
- detect if a user has scrolled to the top of the page and
- stays there for a period of time.
I’ve managed to get the first point working with the code below but don’t have a clue about the second.
$(window).scroll(function() {
if($(window).scrollTop() == 0) {
// do something
}
});
So basically you can do a setTimeout, and then clear the timeout if they scroll again. For example:
Working example: http://jsfiddle.net/dXRhb/2/