src/preview.js
// get the direction of the mouse wheel
get the direction of the mouse wheel
get the direction of the mouse wheel
function isMouseWheelUp(e) {
    e = e || window.event;  
    var delta = 0;
    if (e.wheelDelta) { 
        delta = e.wheelDelta / 120; 
        if (window.opera) delta = -delta;   
    } else if (e.detail) {  
        delta = -e.detail / 3;
    }
    return delta > 0;
}
function isMouseWheelUp ( e ) { e = e || window . event ; var delta = 0 ; if ( e . wheelDelta ) { delta = e . wheelDelta / 120 ; if ( window . opera ) delta = - delta ; } else if ( e . detail ) { delta = - e . detail / 3 ; } return delta > 0 ; }
get the direction of the mouse wheel
get the direction of the mouse wheel
// window.event: 在ie下，事件对象是全局的，作为window的一个属性。event在其他浏览器中作为方法的第一个参数传入 // 或 if (!e) e = window.event; //IE、chrome浏览器使用的是wheelDelta，并且值为“正负120” //因为IE、chrome等向下滚动是负值，FF是正值，为了处理一致性，在此取反处理 //FF浏览器使用的是detail,其值为“正负3”