Reputation: 3541
I am working on jquery
event where div
with class low_price
animates based on which direction we scroll.If we scroll up the div scrolls up and scrolls down when we scroll down.
But this code is not working on laptop mousepad scroll.
This code is only working on chrome not on any other browser.
HERE is a fiddle.
Here is the code.
$(window).bind('mousewheel DOMMouseScroll', function(event) {
if (event.originalEvent.wheelDelta >= 0) {
$(".low_price").animate({top: '0'}, "fast");
}
else {
$(".low_price").animate({top: '80px'}, "fast");
}
});
Upvotes: 0
Views: 577
Reputation: 8420
What about to use:
event.originalEvent.detail
edited 2: https://jsfiddle.net/pmiranda/1fud1roa/1/
I took it from here: event.wheelDelta returns undefined
Upvotes: 1