2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.net/yui/license.txt
8 YUI.add('event-mousewheel', function(Y) {
11 * Adds mousewheel event support
13 * @submodule event-mousewheel
15 var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
16 fixArgs = function(args) {
17 var a = Y.Array(args, 0, true), target;
19 a[0] = DOM_MOUSE_SCROLL;
20 target = Y.config.win;
22 target = Y.config.doc;
28 a.splice(2, 0, target);
35 * Mousewheel event. This listener is automatically attached to the
36 * correct target, so one should not be supplied. Mouse wheel
37 * direction and velocity is stored in the 'mouseDelta' field.
39 * @param type {string} 'mousewheel'
40 * @param fn {function} the callback to execute
41 * @param context optional context object
42 * @param args 0..n additional arguments to provide to the listener.
43 * @return {EventHandle} the detach handle
46 Y.Env.evt.plugins.mousewheel = {
48 return Y.Event._attach(fixArgs(arguments));
52 return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
57 }, '3.0.0' ,{requires:['node-base']});