I’m trying to find a solution to capture the mouse up (scroll End) event on a whole window scrollbar.
but this code works only sporadic. any help will be highly appreciated.
<script type="text/javascript">
$(function() {
var scrollTimer;
var isMouseDown = false;
$(window)
.mousedown(function(event) {
clearTimeout(scrollTimer);
isMouseDown = true;
})
.mouseup(function(event) {
isMouseDown = false;
})
.scroll(function (event) {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(function() {
if (! isMouseDown) {
console.log('UP');
}
}, 500);
});
});
</script>
I think this is what you’re after:
Here is a link to the jquery library I used:
http://james.padolsey.com/demos/scrollevents/scroll-startstop.events.jquery.js