-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Refactored scrolling functionality to fail gracefully #1186
Conversation
if target.scrollHeight > target.getHeight() and ((delta < 0 and bottom_overflow) or (delta > 0 and top_overflow)) | ||
evt.preventDefault() | ||
|
||
delta = -evt.wheelDelta or evt.detail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this work in the Prototype version, but we have to use originalEvent
in the jQuery version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newer versions of jQuery do not support evt.wheelData or evt.detail. Apparently jQuery overrides the event but shoves all the original event properties in originalEvent. There's not a lot of info I can find.
http://stackoverflow.com/questions/8886281/event-wheeldelta-returns-undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jQuery listeners receive a jQuery.Event
object normalizing differences between browsers. evt.originalEvent
is the native event object being wrapped by jQuery. See http://api.jquery.com/category/events/event-object/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. What @stof said 😃
I have one question (possibly non-blocking depending on your answer), but otherwise this looks good to me. I like the removal of the Firefox-specific event handler. |
Refactored scrolling functionality to fail gracefully
@pfiller Here's a much better, cleaner version of the scroll fix. This checks for the correct properties and fails gracefully if there is not delta. This is for Issue #1184
More info on wheelDeta here: http://stackoverflow.com/questions/8886281/event-wheeldelta-returns-undefined