how is it possible catch the "mousewheel" event on a body with an hidden overflow?
I have already tried this but it doesn't work on my case.
how is it possible catch the "mousewheel" event on a body with an hidden overflow?
I have already tried this but it doesn't work on my case.
You can use jQuery mousewheel plugin.
EDIT: Here is the code from my plugin:
var self = this;
var scroll_object;
if (!navigator.userAgent.toLowerCase().match(/(webkit)[ \/]([\w.]+)/) &&
self[0].tagName.toLowerCase() == 'body') {
scroll_object = $('html');
} else {
scroll_object = self;
}
...
self = $.extend(self, {
scroll: function(amount) {
var pos;
amount = Math.round(amount);
if (scroll_object.prop) {
if (amount > scroll_object.prop('scrollTop') && amount > 0) {
scroll_object.prop('scrollTop', 0);
}
pos = scroll_object.prop('scrollTop');
scroll_object.scrollTop(pos + amount);
return self;
} else {
if (amount > scroll_object.attr('scrollTop') && amount > 0) {
scroll_object.attr('scrollTop', 0);
}
pos = scroll_object.attr('scrollTop');
scroll_object.scrollTop(pos + amount);
return self;
}
},
...
self.mousewheel(function(event, delta) {
if (delta > 0) {
self.scroll(-40);
} else {
self.scroll(40);
}
return false;
}, true);