yads / ngTinyScrollbar

An angular directive port of the TinyScrollbar
MIT License
55 stars 20 forks source link

Mouse wheel scrolling not working #3

Closed tomasszabo closed 9 years ago

tomasszabo commented 9 years ago

Mouse wheel scrolling was not working for me. The wheel function in scrollbar directive was fired but the delta was not computed correctly (i.e. it was 0, so the content was not moved to any direction). I've investigated the problem and it seems that the event object that is the input argument into wheel function does not contain delta properties.

I've changed following line

  var evntObj = event || $window.event,

to

  var evntObj = event.originalEvent || $window.event,

because the originalEvent property contains the original jQuery/jqLite event (which encapsulates the event from browser) and contains the delta properties. This solved my wheel scrolling problem (at least in newest Safari, Chrome and Firefox).

Btw. in your code, sometimes you are referencing to $window and sometimes to window. Just a side note.

yads commented 9 years ago

This will only work when you're using jQuery. The code as is works when not using jQuery, so I think we need a different solution that will work when using jQuery and when not.

maybe something like:

var eventObj = (event && event.originalEvent) || event || $window.event;
tomasszabo commented 9 years ago

It's true, I have jQuery on my path. However, what you've proposed is working for me also. It'll be great to see this fix in next release.

yads commented 9 years ago

fixed in 0.7.2