Categories
javascript jquery macos mousewheel

How to check each new scroll and avoid Apple mouses issue (multiple-scroll effect)

I try to make a mousewheel event script, but getting some issues since I’m using an Apple Magic Mouse and its continue-on-scroll function.

I want to do this http://jsfiddle.net/Sg8JQ/ (from jQuery Tools Scrollable with Mousewheel – scroll ONE position and stop, using http://brandonaaron.net/code/mousewheel/demos), but I want a short animation (like 250ms) when scrolling to boxes, AND ability to go throught multiple boxes when scrolling multiple times during one animation. (If I scroll, animation start scrolling to second box, but if I scroll again, I want to go to the third one, and if I scroll two times, to the forth, etc.)

I first thought stopPropagation / preventDefault / return false; could “stop” the mousewheel velocity (and the var delta) – so I can count the number of new scroll events (maybe with a timer) –, but none of them does.

Ideas?

EDIT : If you try to scroll in Google Calendars with these mouses, several calendars are switched, not only one. It seems they can’t fix that neither.

EDIT 2 : I thought unbind mousewheel and bind it again after could stop the mousewheel listener (and don’t listen to the end of inertia). It did not.

EDIT 3 : tried to work out with Dates (thanks to this post), not optimal but better than nothing http://jsfiddle.net/eZ6KE/