#10420 closed bug (fixed)
MouseWheel
Reported by: | anonymous | Owned by: | dmethvin |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7 |
Component: | misc | Version: | 1.7b1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have been using https://github.com/brandonaaron/jquery-mousewheel for years and now it`s broken. If I log event ( console.log(delta, deltaX, deltaY); ) then output is - Firefox: 0 0 0 Chrome: 0 0 -1
(btw, works fine for jQuery 1.6.4 and output is, for example: -1 0 -1)
Change History (17)
comment:1 Changed 12 years ago by
Component: | unfiled → misc |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 12 years ago by
Demos:
Not working - http://jsfiddle.net/Ly9x3/
Working - http://jsfiddle.net/Ly9x3/1/
I would like to find the root of the problem but I only can see that after fixing event (e.g., event = $.event.fix(orgEvent); ) there are no such attributes as wheelDelta OR detail so this plugin, obviously, fails.
An I have no idea what`s going on under that magical $.event.fix
comment:3 Changed 12 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I'm going to reopen this, as it's a result of the jQuery.event.fix refactoring in 1.7b1. The solution should be simple, we just need to have the plugin get its values from origEvent
rather than assuming they were copied to event
. Another solution would be to put the properties onto jQuery.event.fixProps
but simpler seems better.
comment:4 Changed 12 years ago by
Owner: | set to dmethvin |
---|---|
Status: | reopened → assigned |
comment:5 Changed 12 years ago by
Milestone: | None → 1.7 |
---|---|
Priority: | low → blocker |
I'll put together a pull request for Brandon's repo.
https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js#L56
comment:6 Changed 12 years ago by
Just curious: is it absolutely not an option to add mousewheel support to jquery (without addons)? A .mousewheelup() and .mousewheeldown() event would really look great on the list on http://api.jquery.com/category/events/mouse-events/ :)
After all, pretty much every mouse has a scrollwheel. jQuery already normalizes the event.which property, which is great; it does the same for 'keyCode'. In my opinion a mouse's scroll wheel is not that exotic, it's probably >99% as common as a keyboard and a mouse. Does it not deserve the same attention?
comment:7 Changed 12 years ago by
As for the original issue: I changed the original fiddle to exclude the addon. This way perhaps it's easier to test against.
It is using 1.6.4, so change to jQuery (edge) to see it break.
comment:8 Changed 12 years ago by
It also appears that $.event.handler has been renamed $.event.dispatch - by changing the references in the plugin from event to orgEvent and changing the return value to $.event.dispatch.apply(this, args); The plugin starts working again
comment:9 follow-up: 10 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I've put together a patch that seems to work and submitted it to Brandon:
https://github.com/brandonaaron/jquery-mousewheel/pull/15
My (hopefully) fixed copy is here if you'd like to try it, please let me know if you have any issues:
https://raw.github.com/dmethvin/jquery-mousewheel/fix-17-origEvent/jquery.mousewheel.js
@JorisDebonnet: That test case is not quite right since you are looking at the jQuery normalized (fixed) event object and not the native browser event.originalEvent
object that has the browser-specific mousewheel values. Our goal here is to avoid copying properties that only the plugin needs.
comment:10 Changed 12 years ago by
With your version I get: Uncaught TypeError: Cannot call method 'apply' of undefined ($.event.handle is undefined at least in the latest Chrome)
The version you posted needs:
return $.event.handle.apply(this, args);
changed to
return $.event.dispatch.apply(this, args);
And that seems to get things working again in 1.7 - it will however break < 1.7. I am not sure why handle went and dispatch came in but I imagine its to do with some 1.7 refactoring.
Replying to dmethvin:
I've put together a patch that seems to work and submitted it to Brandon:
https://github.com/brandonaaron/jquery-mousewheel/pull/15
My (hopefully) fixed copy is here if you'd like to try it, please let me know if you have any issues:
https://raw.github.com/dmethvin/jquery-mousewheel/fix-17-origEvent/jquery.mousewheel.js
@JorisDebonnet: That test case is not quite right since you are looking at the jQuery normalized (fixed) event object and not the native browser
event.originalEvent
object that has the browser-specific mousewheel values. Our goal here is to avoid copying properties that only the plugin needs.
comment:11 Changed 12 years ago by
Sorry, I should have also specified that you must use the git version instead of rc1, it's at http://code.jquery.com/jquery-git.js .
comment:12 follow-up: 13 Changed 12 years ago by
Not working in Firefox on MacOSX console.log(delta, deltaX, deltaY); outputed: 0 0 0
jquery 1.7 jquery-mousewheel git firefox 7.0.1 mac os x 10.6.6
Also has the same problem in Firefox 7 & Opera 11.50 on Windows XP.
webkit(chrome, safari) is fine.
comment:13 follow-up: 14 Changed 12 years ago by
Replying to heylinus@…:
Not working in Firefox on MacOSX console.log(delta, deltaX, deltaY); outputed: 0 0 0
jquery 1.7 jquery-mousewheel git firefox 7.0.1 mac os x 10.6.6
Also has the same problem in Firefox 7 & Opera 11.50 on Windows XP.
webkit(chrome, safari) is fine.
Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
comment:14 Changed 12 years ago by
Replying to rwaldron:
Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
firefox 7.0.1 (Mac 10.6.6) 1.6.4 and lower working 1.7 and 'edge' return 0 0 0
firefox 7.0.1 (WinXP x86) 1.6.4 and lower return 1 0 1(-1 0 -1) no horizontal scroll 1.7, and 'edge' return 0 0 0
firefox 7.0.1 (Win7 x64) 1.6.4 and lower working 1.7, and 'edge' return 0 0 0
comment:15 follow-up: 16 Changed 12 years ago by
You'll need an update to the mousewheel plugin; I put in a pull request to Brandon and you can track it here:
comment:16 Changed 11 years ago by
Replying to dmethvin:
You'll need an update to the mousewheel plugin; I put in a pull request to Brandon and you can track it here:
Works excellent in Windows Firefox and Mac
comment:17 Changed 11 years ago by
A fix for any script using the movement of the mousewheel is (where e is the event):
if(!e.detail && !e.wheelDelta){e = e.originalEvent;}
Please file a bug with jQuery mousewheel or you can provide a reduced test case that does not include plugins to indicate an issue with jQuery core.