I've been looking for such a thing but never found a cross-browser way of doing it. We can't include something that's not cross-browser into -core. Maybe you could create a plugin that overwrites the Mootools Event Class. Thanks for everything.
-- Fábio Miranda Costa Solucione Sistemas Engenheiro de interfaces Twitter: fabiomiranda http://solucione.info On Wed, May 26, 2010 at 5:28 PM, klaas moerman <[email protected]>wrote: > While making custom scrollbars with mootools, I noticed that it isn't > possible to know with mootools whether the scrolling happened in the > vertical or horizontal direction (devices like Apple Mighty Mouse, > Wacom Pen, some touchpads, are all capable of scrolling both ways). As > a result I have never seen fully functional javascript scrollbar > implementations. As an example: recently I made this site: > http://www.feretdubois.be/en/2-metaal/, which has custom javascript > scrollbars capable of scrolling both ways, however, the code I wrote > to make it work lacks in elegance and flexibility, which is what I'd > like to address now. > > I have figured out a way to detect the scroll axis on Gecko and WebKit > engined browsers (safari, chrome, firefox ...), but not in Opera > (Presto engine) or Internet Explorer (though I'm not sure Windows is > capable of detecting horizontal scrolling at all): > > in the Event.js script: > > var Event = new Native({ > ... > > if (type.match(/DOMMouseScroll|mousewheel/)){ > var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : - > (event.detail || 0) / 3; > var axis = (event.wheelDeltaX) ? 'x' : (event.axis && event.axis == > event.HORIZONTAL_AXIS) ? 'x' : 'y'; //wheelDeltaX for WebKit, > event.axis for Gecko > } > > ... > > return $extend(this, { > ... > wheel: wheel, > axis: axis, > ... > } > > }); > > this adds an 'axis' property to the event, set to either 'x' or > 'y' (defaults to 'y'). > > If anyone knows how to extend this to other Browsers or Engines please > let me know, or if any of the mootools developers should read this, > maybe consider it for the next update. > > thanks > > klaas >
