简体   繁体   中英

Jquery mousewheel event working only on Chrome

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");
    }
});

What about to use:

event.originalEvent.detail

edited 2: https://jsfiddle.net/pmiranda/1fud1roa/1/

I took it from here: event.wheelDelta returns undefined

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM