美文网首页
阻止浏览器缩放

阻止浏览器缩放

作者: 爱代码的派派星 | 来源:发表于2019-12-15 23:11 被阅读0次
<!DOCTYPE html>
<html>
<head>
    <title>frameSelect</title>
  <style>
   
  </style>
  <script src="https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
   <script type="text/javascript">
 
$(document).ready(function () {
   window.addEventListener('mousewheel', function(event){
    if (event.ctrlKey === true || event.metaKey) {
          event.preventDefault();
    }
},{ passive: false});

//firefox
 window.addEventListener('DOMMouseScroll', function(event){
    if (event.ctrlKey === true || event.metaKey) {
           event.preventDefault();
    }
},{ passive: false});
});
</script>
</head>
<body>
 
  <div class="fileDiv ">fi222le7</div>
  <div class="fileDiv ">file8</div>
</body>
</html>     

相关文章

网友评论

      本文标题:阻止浏览器缩放

      本文链接:https://www.haomeiwen.com/subject/wjzlnctx.html