Bug Tracker

Modify

Ticket #10420 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

MouseWheel

Reported by: anonymous Owned by: dmethvin
Priority: blocker Milestone: 1.7
Component: misc Version: 1.7b1
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to misc

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.

comment:2 Changed 3 years ago by anonymous

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 3 years ago by dmethvin

  • Status changed from closed to reopened
  • Resolution invalid deleted

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 3 years ago by dmethvin

  • Owner set to dmethvin
  • Status changed from reopened to assigned

comment:5 Changed 3 years ago by dmethvin

  • Priority changed from low to blocker
  • Milestone changed from None to 1.7

comment:6 Changed 3 years ago by JorisDebonnet

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'; and 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 a spot within jQuery?

Version 0, edited 3 years ago by JorisDebonnet (next)

comment:7 Changed 3 years ago by JorisDebonnet

As for the original issue: I changed the original fiddle to exclude the addon. This way perhaps it's easier to test against.

 http://jsfiddle.net/Ly9x3/5/

It is using 1.6.4, so change to jQuery (edge) to see it break.

Last edited 3 years ago by JorisDebonnet (previous) (diff)

comment:8 Changed 2 years ago by anonymous

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 2 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed

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 in reply to: ↑ 9 Changed 2 years ago by cousins217

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 2 years ago by dmethvin

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 2 years ago by 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.

comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 2 years ago by rwaldron

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 in reply to: ↑ 13 Changed 2 years ago by heylinus

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.

 http://jsfiddle.net/Ly9x3/1/

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 2 years ago by dmethvin

You'll need an update to the mousewheel plugin; I put in a pull request to Brandon and you can track it here:

 https://github.com/brandonaaron/jquery-mousewheel/pull/17

comment:16 in reply to: ↑ 15 Changed 2 years ago by anonymous

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:

 https://github.com/brandonaaron/jquery-mousewheel/pull/17

Works excellent in Windows Firefox and Mac

comment:17 Changed 2 years ago by anonymous

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 follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.