Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll (preventdefault) on firefox 17 not working properly #45

Closed
ilu opened this issue Dec 12, 2012 · 6 comments
Closed

Scroll (preventdefault) on firefox 17 not working properly #45

ilu opened this issue Dec 12, 2012 · 6 comments

Comments

@ilu
Copy link

ilu commented Dec 12, 2012

(Originally reported this at the jScrollPane repo: vitch/jScrollPane#198)

I just noticed that at least I am facing a problem with the mouse scroll on Firefox 17: Scrolling the content area with the mouse wheel etc. will also scroll the whole page. This seems to apply to the examples included with jScrollPane and jQuery Mousewheel as well, specifically Test#2 (prevent default) is not working properly. Works normal on Firefox 16, Chrome and Safari.

Using jScrollPane v2.0.0beta12 - 2012-09-27, jQuery Mousewheel.js 3.0.6, Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:18.0) Gecko/20100101 Firefox/18.0

I'm guessing this is related to the new Wheel Event in FF17: https://wiki.mozilla.org/Gecko:Mouse_Wheel_Scrolling#DOM_mouse_wheel_events_and_Default_action

@ZalemCitizen
Copy link

Same issue there, as I was trying to make jquery.sbscroller.js work properly (http://www.simonbattersby.com/blog/vertical-scrollbar-plugin-using-jquery-ui-slider/)

You have to change the event list from
["DOMMouseScroll", "mousewheel"]
to
["DOMMouseScroll", "mousewheel", "wheel"]

Tested in Chrome and FF17, and seems to work
Thanks for your report ilu, I'm sure I wouldn't have thought it was related to the release of FF17

@ilu
Copy link
Author

ilu commented Dec 14, 2012

Changing line 15 from
var types = ['DOMMouseScroll', 'mousewheel'];
to
var types = ['DOMMouseScroll', 'mousewheel', 'wheel'];

disables scrolling jScrollPane elements altogether in Firefox 18. No effect on Chrome 25, still works.

Edit: Tested the mousewheel test page with the suggested changes, test#2 (preventDefault) is now not firing at all.

Thanks for the suggestion though, ZalemCitizen.

@ZalemCitizen
Copy link

Yes I can't explain myself why this change worked a few time and don't anymore...
still investingating

@hirbod
Copy link

hirbod commented Dec 29, 2012

I've found a solution for this problem:

wheel does not work anymore / or at the moment.

try this instead:

var types = ['DOMMouseScroll', 'mousewheel', 'MozMousePixelScroll', 'wheel'];

MDN:
The DOM MozMousePixelScroll event is fired asynchronously when mouse wheel or similar device is operated. It's represented by the MouseScrollEvent interface.

If you want to prevent the default action of mouse wheel events on Gecko 17 (Firefox 17) or later, you need to call preventDefault() of wheel because if two or more wheel events caused only 1 pixel scroll, this event wouldn't be fired.

Hint:
So adding MozMousePixelScroll will fix this problem. But the speed is really high.. maybe some adjustments are required. I've also tried to use this whitout "wheel" and this works too. But i think upcoming releases will just use the wheel event.

Tested with FF17 and FF Aurora (19a2), Safari 6, current Chrome.. Works!

@loayza
Copy link

loayza commented Jan 3, 2013

In my case, FF 17.0.1 OS X, the solution was:

var types = ['DOMMouseScroll', 'mousewheel', 'MozMousePixelScroll'];

I excluded 'wheel' event because it was causing aditional problems.

Also tested successfully in Safari 6.0.2, Chrome 23, IE 8 and IE 9.

@brandonaaron
Copy link
Contributor

Fixed in 3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants