Yeah pretty much everything can be put inside .scroll()
event handler from jQuery.
http://api.jquery.com/scroll/
And to detect stop check out this post :
Fire event after scrollling scrollbars or mousewheel with javascript
You basically set a Timeout to check if you are still scrolling and if not trigger the stopped scrolling event
EDIT: was funny to implement
var scrollChecker = null;
var scrollTimeout = null;
var createScrollEvents = function (e) {
var $this = $(this);
$this.data('scrolling', true);
if (!scrollChecker) {
$this.trigger('scrollStart');
scrollChecker = setInterval(function () {
if (!$this.data('scrolling')) {
$this.trigger('scrollStop');
clearTimeout(scrollChecker);
scrollChecker = null;
}
}, 200);
}
$this.trigger('scrolling');
if (scrollTimeout) {
clearTimeout(scrollTimeout);
}
scrollTimeout = setTimeout(function () {
$this.data('scrolling', false);
}, 200);
};
$(function () {
$('#mydiv')
//init
.scroll(createScrollEvents)
//events
.on('scrollStart', function (e) {
console.log('start');
})
.on('scrollStop', function (e) {
console.log('stop');
})
.on('scrolling', function (e) {
console.log('scrolling');
});
//end
});
CSS
#mydiv {
width:200px;
height:200px;
overflow : auto;
}
don't forget this, read .scroll()
documentation :
It applies to window objects, but also to scrollable frames and
elements with the overflow
CSS property set to scroll
(or auto
when
the element's explicit height or width is less than the height or
width of its contents).
http://jsfiddle.net/techunter/LxTqY/