判断鼠标往上还是往下滚动
html代码:
<div class="div">
</div>
css代码:
.div{
position:absolute;
width:100%;
height:120%;
border:1px red solid;
}
js代码:
/IE CHORME/
document.body.onmousewheel=function(event){
event=event||window.event;
var direction=event.wheelDelta&&(event.wheelDelta>0?"mouseup":"mousedown");
console.log(direction);
}
/firefix/
document.body.addListener('DOMMouseScroll',function(event){
var direction=event.detail&&(event.detail>0?"mousedown":"mouseup");
console.log(direction);
}