Here is short plugin which achieves the functionality you want (thanks to Barmar for the idea):
$.fn.wheel = function (callback) {
return this.each(function () {
$(this).on('mousewheel DOMMouseScroll', function (e) {
e.delta = null;
if (e.originalEvent) {
if (e.originalEvent.wheelDelta) e.delta = e.originalEvent.wheelDelta / -40;
if (e.originalEvent.deltaY) e.delta = e.originalEvent.deltaY;
if (e.originalEvent.detail) e.delta = e.originalEvent.detail;
}
if (typeof callback == 'function') {
callback.call(this, e);
}
});
});
};
$('body').wheel(function (e) {
console.log(e);
});
It's pretty self explanatory but it basically just binds the mousewheel DOMMouseScroll
to every element it's called on. It also passes on the event object as a callback argument.
Here it is working: http://jsfiddle.net/uTbGp/2/ (Mark's fiddle with his improved version of the plugin)