js禁用鼠标滚动wheel/DomMouseScroll
function scrollFunc(evt) {
evt = evt || window.event;
if(evt.preventDefault) {
// Firefox
evt.preventDefault();
evt.stopPropagation();
} else {
// IE
evt.cancelBubble=true;
evt.returnValue = false;
}
return false;
}
function disabledMouseWheel(obj) {
if (document.addEventListener) {
obj.addEventListener('DOMMouseScroll', scrollFunc, false);
}//W3C
obj.onmousewheel = scrollFunc;//IE/Opera/Chrome
}
//在某个元素上禁用鼠标滚动
$('.el').each(function(){
disabledMouseWheel(this);
});
//禁用整个窗口滚动事件
window.onload = disabledMouseWheel(this);