Fork me on GitHub

Ractive.js mousewheel event plugin

download: ractive-events-mousewheel.js more plugins at

Dealing with mousewheel events in browsers is an epic pain. The official DOM wheel event is badly designed enough that Chrome, Opera and Safari have so far refused to implement it, which isn't to say that the non-standard mousewheel event (or the DOMMouseScroll and MozMousePixelScroll events – yes, really) is a whole lot better. It's a total mess.

The mousewheel event plugin is a (work-in-progress!) attempt to smooth over differences between browsers and operating systems, and provide you with the only bit of information you actually care about in 99% of cases: how many pixels of scroll the mousewheel event is equivalent to.

Be aware that intercepting mousewheel events rather than using native scroll is often a bad idea – it doesn't perform as well in all cases, and doesn't work with mobile devices.