Yes, this is the same as the mouse wheel. There are ways on the Internet to catch exactly the wheel and not the page scroll. If you follow the scroll, then you can use the eternal cycle. I do not remember how he is called in a special way. If the wheel, then the Internet can only be found upside down. Less common and right to the left.
/* Web App Kit Project (WakaProject). /Waka/Events/onwheel.js - events on wheel up,down,left and right. Copyright (C) 2012 TrigenSoftware This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see < http://www.gnu.org/licenses/>. args: delta, deltaX, deltaY - mouse wheel deltas. recommend: to prevent event on parent element you can use event.stopPropagation(). */ (function($){ $.event.special.wheelup = $.event.special.wheeldown = $.event.special.wheelleft = $.event.special.wheelright = { setup: function(){ if(waka.touchable)return false; // Gecko, WebKit if(this.addEventListener) this.addEventListener('DOMMouseScroll', handler, false); // IE, Presto this.onmousewheel = handler; }, teardown: function(){ if(waka.touchable)return false; // Gecko, WebKit if(this.removeEventListener) this.removeEventListener('DOMMouseScroll', handler, false); // IE, Presto this.onmousewheel = null; } }; $.fn.extend({ wheelup: function(f){ return f ? this.bind('wheelup',f) : this.trigger('wheelup'); }, unwheelup: function(f){ return this.unbind('wheelup',f); }, wheeldown: function(f){ return f ? this.bind('wheeldown',f) : this.trigger('wheeldown'); }, unwheeldown: function(f){ return this.unbind('wheeldown',f); }, wheelleft: function(f){ return f ? this.bind('wheelleft',f) : this.trigger('wheelleft'); }, unwheelleft: function(f){ return this.unbind('wheelleft',f); }, wheelright: function(f){ return f ? this.bind('wheelright',f) : this.trigger('wheelright'); }, unwheelright: function(f){ return this.unbind('wheelright',f); } }); function handler(ev){ var e = ev, args = [].slice.call( arguments, 1 ), delta = 0, deltaX = 0, deltaY = 0; ev = $.event.fix(e); // Old school scrollwheel delta if(e.wheelDelta)delta = e.wheelDelta/120; if(e.detail)delta = -e.detail/3; // New school multidimensional scroll (touchpads) deltas deltaY = delta; // Gecko if(e.axis !== undefined && e.axis === e.HORIZONTAL_AXIS){ deltaX = -1*delta; } // Webkit if(e.wheelDeltaY !== undefined )deltaY = e.wheelDeltaY/120; if(e.wheelDeltaX !== undefined )deltaX = -1*e.wheelDeltaX/120; if(deltaY > 0)ev.type = 'wheelup'; if(deltaY < 0)ev.type = 'wheeldown'; if(deltaX > 0)ev.type = 'wheelright'; if(deltaX < 0)ev.type = 'wheelleft'; // Add event and delta to the front of the arguments args.unshift(ev, delta, deltaX, deltaY); return ($.event.dispatch || $.event.handle).apply(this, args); } })(jQuery);
Here I wrote an event for my library for my library. $(selector).wheelup/down/left/right(func);
can and bind.