简体   繁体   中英

CustomScrollbar too fast

I am working with the customscrollbar plugin to create a cross browser custom scrollbar.

The issue is, I can't figure out why my scrollbar is too sensitive. On a touchpad, it goes down by almost 400 px with a slight scroll. Same for the mousewheel as well. I tried debugging in and I thought that the issue might be because of the mousewheel plugin, but still no luck.

My code is pretty straight forward -

$('body').mCustomScrollbar({ scrollInertia:1500 });

You need to define where to actually scroll, for example:

$(selector).mCustomScrollbar("scrollTo", "bottom",
        { scrollInertia:1500 });

The problem is with mousewheel events - touchpad generates several times more mousewheel events than usual mouse. New version of plugin (3.0.2) incorrectly handles mousewheel events generated by touchpad. Try previous version (2.8.3) - it handles touchpad mousewheel correctly (as I can see from my examples) or contact author and create the bug in issue tracker.

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