Event.stop doesn't work in Safari for mousewheel
Reported by Michael Shkutkov | August 29th, 2008 @ 11:48 AM
First a piece of code:
Event.observe(window, 'load', function() {
Event.observe($('id'), 'mousewheel', Player.onMouseWheel);
Event.observe($('id'), 'DOMMouseScroll',Player.onMouseWheel);
}
var Player = {
onMouseWheel: function(e) {
// doesn't matter
Event.stop(e);
}
Everything works everywhere, except one case: if you scroll page using two fingers on trackpad (MacBook, MacBook Pro, etc.) in Safari. It seems that Event.stop doesn't work. Not sure, but may be two finder scrolling sends one more event, so we need to stop it as well.
At present moment you can look at the problem here: http://www.songsterr.com/a/wa/so...
Comments and changes to this ticket
-
John-David Dalton August 29th, 2008 @ 04:42 PM
- → State changed from new to not_for_core
I think this would make a great extension. Could you patch this in and submit it to Scripteka.com ?
I know jQuery handles this as a plugin as well.
-
John-David Dalton August 29th, 2008 @ 04:58 PM
// Mouse Wheel Detection // http://andrewdupont.net/2007/11/07/pseudo-custom-events-in-prototype-16/ // http://www.simpltry.com/2006/12/27/emulating-mouse-wheel-map-zooming/#more-31 // usage: $(element).observe('mouse:wheel', function() {...}); (function() { function wheel(event) { var realDelta; //normalize the delta if (event.wheelDelta) { realDelta = event.wheelDelta / 120; //IE & Opera } else if (event.detail) { realDelta = -event.detail / 3; //W3C } else return; var customEvent = event.element() .fire("mouse:wheel", { delta: realDelta }); if(customEvent.stopped) event.stop(); } document.observe("mousewheel", wheel) .observe("DOMMouseScroll", wheel); })(); -

Michael Shkutkov September 5th, 2008 @ 12:26 AM
I know jQuery handles this as a plugin as well.
Actually I've spent a lot of time, but I haven't found solution.
E.g. this example http://brandonaaron.net/jquery/p... doesn't work for me. I guess we cannot prevent default action of two fingers scrolling on trackpad. Not sure, but maybe it's a Safari bug.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
