Ok with this..
$(window).scroll(function()
{
$('.slides_layover').removeClass('showing_layover');
$('#slides_effect').show();
});
I can tell when someone is scrolling from what i understand. So with that I am trying to figure out how to catch when someone has stopped. From the above example you can see I am removing a class from a set of elements while the scrolling is occurring. However, I want to put that class back on when the user stops scrolling.
The reason for this is I am intent on having a layover show while the page is scrolling to give the page a special effect I am attempting to work on. But the one class I am trying to remove while scrolling conflicts with that effect as its a transparency effect to some nature.
You could set an interval that runs every 500 ms or so, along the lines of the following:
I haven't tested this code, but the principle should work.
Ok this is something that I've used before. Basically you look a hold a ref to the last
scrollTop()
. Once your timeout clears, you check the currentscrollTop()
and if they are the same, you are done scrolling.I agreed with some of the comments above that listening for a timeout wasn't accurate enough as that will trigger when you stop moving the scroll bar for long enough instead of when you stop scrolling. I think a better solution is to listen for the user letting go of the mouse (mouseup) as soon as they start scrolling:
and an example of it working can be seen in this JSFiddle
This should work:
very small Version with start and end ability
For those Who Still Need This Here Is The Solution