阻止网页内部滚动条mousewheel事件冒泡

function preventScroll(id){  
    var _this = document.getElementById(id);  
    if(navigator.userAgent.indexOf("Firefox")>0){  
        _this.addEventListener('DOMMouseScroll',function(e){  
            _this.scrollTop += e.detail > 0 ? 60 : -60;     
            e.preventDefault();  
        },false);   
    }else{  
        _this.onmousewheel = function(e){     
            e = e || window.event;     
            _this.scrollTop += e.wheelDelta > 0 ? -60 : 60;     
            return false;  
        };  
    }  
    return this;  
}  

转自 :http://blog.csdn.net/jyy_12/article/details/6878049

posted @ 2016-10-20 16:38  jamess  阅读(2698)  评论(0编辑  收藏  举报