wieringen / tinyscrollbar

A lightweight cross browser javascript scrollbar.
http://baijs.com/tinyscrollbar
Other
398 stars 203 forks source link

Fix nested scrolling issue in Firefox #17

Closed djfarrelly closed 10 years ago

djfarrelly commented 10 years ago

This PR fixes #16 which reported an issue with tinyscrollbar in Firefox 28 on OSX (possibly elsewhere) where the scrolling area would scroll at the same time as the window would scroll, creating a strange, undesirable parallax effect.

To replicate the issue

On FF 28 on OSX, create page which scrolls normally, i.e. the body is taller than the window. Then create a tinyscrollbar div any size. Scrolling the tinyscrollbar div should scroll while the page also scrolls.

The fix

I used the newer wheel event over mousewheel or DOMMouseScroll where available and normalized the event.deltaY value for consistent cross browser scrolling. MDN has some great information for reference [source]. We normalize the event.deltaY value with a fallback to event.wheelDeltaY and event.detail when necessary.

Thanks

Thanks for creating this scrollbar plugin, it's pretty awesome! After looking into and testing others, this was a great choice with the small size and browser support that we were looking for. Hoping to contribute any future fixes we come across!

wieringen commented 10 years ago

It seems there still are a few bugs. In ie8 wheelSpeedDelta is now NaN.