API Docs for: 3.8.0
Show:

File: event/js/mousewheel.js

  1. /**
  2.  * Adds mousewheel event support
  3.  * @module event
  4.  * @submodule event-mousewheel
  5.  */
  6. var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
  7.     fixArgs = function(args) {
  8.         var a = Y.Array(args, 0, true), target;
  9.         if (Y.UA.gecko) {
  10.             a[0] = DOM_MOUSE_SCROLL;
  11.             target = Y.config.win;
  12.         } else {
  13.             target = Y.config.doc;
  14.         }

  15.         if (a.length < 3) {
  16.             a[2] = target;
  17.         } else {
  18.             a.splice(2, 0, target);
  19.         }

  20.         return a;
  21.     };

  22. /**
  23.  * Mousewheel event.  This listener is automatically attached to the
  24.  * correct target, so one should not be supplied.  Mouse wheel
  25.  * direction and velocity is stored in the 'wheelDelta' field.
  26.  * @event mousewheel
  27.  * @param type {string} 'mousewheel'
  28.  * @param fn {function} the callback to execute
  29.  * @param context optional context object
  30.  * @param args 0..n additional arguments to provide to the listener.
  31.  * @return {EventHandle} the detach handle
  32.  * @for YUI
  33.  */
  34. Y.Env.evt.plugins.mousewheel = {
  35.     on: function() {
  36.         return Y.Event._attach(fixArgs(arguments));
  37.     },

  38.     detach: function() {
  39.         return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
  40.     }
  41. };

  42.