You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
2 years ago
|
/*
|
||
|
YUI 3.17.2 (build 9c3c78e)
|
||
|
Copyright 2014 Yahoo! Inc. All rights reserved.
|
||
|
Licensed under the BSD License.
|
||
|
http://yuilibrary.com/license/
|
||
|
*/
|
||
|
|
||
|
YUI.add('event-mousewheel', function (Y, NAME) {
|
||
|
|
||
|
/**
|
||
|
* Adds mousewheel event support
|
||
|
* @module event
|
||
|
* @submodule event-mousewheel
|
||
|
*/
|
||
|
var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
|
||
|
fixArgs = function(args) {
|
||
|
var a = Y.Array(args, 0, true), target;
|
||
|
if (Y.UA.gecko) {
|
||
|
a[0] = DOM_MOUSE_SCROLL;
|
||
|
target = Y.config.win;
|
||
|
} else {
|
||
|
target = Y.config.doc;
|
||
|
}
|
||
|
|
||
|
if (a.length < 3) {
|
||
|
a[2] = target;
|
||
|
} else {
|
||
|
a.splice(2, 0, target);
|
||
|
}
|
||
|
|
||
|
return a;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Mousewheel event. This listener is automatically attached to the
|
||
|
* correct target, so one should not be supplied. Mouse wheel
|
||
|
* direction and velocity is stored in the 'wheelDelta' field.
|
||
|
* @event mousewheel
|
||
|
* @param type {string} 'mousewheel'
|
||
|
* @param fn {function} the callback to execute
|
||
|
* @param context optional context object
|
||
|
* @param args 0..n additional arguments to provide to the listener.
|
||
|
* @return {EventHandle} the detach handle
|
||
|
* @for YUI
|
||
|
*/
|
||
|
Y.Env.evt.plugins.mousewheel = {
|
||
|
on: function() {
|
||
|
return Y.Event._attach(fixArgs(arguments));
|
||
|
},
|
||
|
|
||
|
detach: function() {
|
||
|
return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
}, '3.17.2', {"requires": ["node-base"]});
|