首页 > Web开发 > 详细

jquery鼠标移入某区域屏蔽鼠标滚轮 滚动滚动条

时间:2014-12-03 22:52:36      阅读:393      评论:0      收藏:0      [点我收藏+]
<script>
    var firefox = navigator.userAgent.indexOf(‘Firefox‘) != -1;
    function MouseWheel(e) {
    ///对img按下鼠标滚路,阻止视窗滚动
        e = e || window.event;
        if (e.stopPropagation) e.stopPropagation();
        else e.cancelBubble = true;
        if (e.preventDefault) e.preventDefault();
        else e.returnValue = false;

        //其他代码
    }
    window.onload = function () {
        var img = document.getElementById(‘img‘);
        firefox ? img.addEventListener(‘DOMMouseScroll‘, MouseWheel, false) : (img.onmousewheel = MouseWheel);
    }
</script><div style="height:100px"></div>
<img src="http://avatar.profile.csdn.net/C/5/A/1_px372265205.jpg" id="img" style="width:200px"/>
<div style="height:1000px"></div>

 帖子地址:http://bbs.csdn.net/topics/390516035

jquery鼠标移入某区域屏蔽鼠标滚轮 滚动滚动条

原文:http://www.cnblogs.com/lixiuran/p/4141367.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!