src/uniwheel.js
function createCallback(element,callback) {

    var fn = function(originalEvent) {

      !originalEvent && ( originalEvent = window.event );

      // create a normalized event object
      var event = {
        // keep a ref to the original event object
        originalEvent: originalEvent,
        target: originalEvent.target || originalEvent.srcElement,
        type: "wheel",
        deltaMode: originalEvent.type == "MozMousePixelScroll" ? 0 : 1,
        deltaX: 0,
        delatZ: 0,
        preventDefault: function() {
          originalEvent.preventDefault ?
            originalEvent.preventDefault() :
            originalEvent.returnValue = false;
        }
      };

      // calculate deltaY (and deltaX) according to the event
      if ( support == "mousewheel" ) {
        event.deltaY = - 1/40 * originalEvent.wheelDelta;
        // Webkit also support wheelDeltaX
        originalEvent.wheelDeltaX && ( event.deltaX = - 1/40 * originalEvent.wheelDeltaX );
      } else {
        event.deltaY = originalEvent.detail;
      }

      // it's time to fire the callback
      return callback( event );

    };

    fns.push({
      element: element,
      fn: fn,
    });

    return fn;
  }
function createCallback(element,callback) {

    var fn = function(originalEvent) {

      !originalEvent && ( originalEvent = window.event );

      // create a normalized event object
      var event = {
        // keep a ref to the original event object
        originalEvent: originalEvent,
        target: originalEvent.target || originalEvent.srcElement,
        type: "wheel",
        deltaMode: originalEvent.type == "MozMousePixelScroll" ? 0 : 1,
        deltaX: 0,
        delatZ: 0,
        preventDefault: function() {
          originalEvent.preventDefault ?
            originalEvent.preventDefault() :
            originalEvent.returnValue = false;
        }
      };

      // calculate deltaY (and deltaX) according to the event
      if ( support == "mousewheel" ) {
        event.deltaY = - 1/40 * originalEvent.wheelDelta;
        // Webkit also support wheelDeltaX
        originalEvent.wheelDeltaX && ( event.deltaX = - 1/40 * originalEvent.wheelDeltaX );
      } else {
        event.deltaY = originalEvent.detail;
      }

      // it's time to fire the callback
      return callback( event );

    };

    fns.push({
      element: element,
      fn: fn,
    });

    return fn;
  }
function createCallback ( element , callback ) { var fn = function ( originalEvent ) { ! originalEvent && ( originalEvent = window . event ) ; // create a normalized event object var event = { // keep a ref to the original event object originalEvent : originalEvent , target : originalEvent . target || originalEvent . srcElement , type : "wheel" , deltaMode : originalEvent . type == "MozMousePixelScroll" ? 0 : 1 , deltaX : 0 , delatZ : 0 , preventDefault : function ( ) { originalEvent . preventDefault ? originalEvent . preventDefault ( ) : originalEvent . returnValue = false ; } } ; // calculate deltaY (and deltaX) according to the event if ( support == "mousewheel" ) { event . deltaY = - 1 / 40 * originalEvent . wheelDelta ; // Webkit also support wheelDeltaX originalEvent . wheelDeltaX && ( event . deltaX = - 1 / 40 * originalEvent . wheelDeltaX ) ; } else { event . deltaY = originalEvent . detail ; } // it's time to fire the callback return callback ( event ) ; } ; fns . push ( { element : element , fn : fn , } ) ; return fn ; }
let's assume that remaining browsers are older Firefox
let s assume that remaining browsers are older Firefox