禁止页面缩放(禁止页面使用滚轮)

    <!--<script>-->
        <!--//禁止页面滚轮-->
        <!--function disabledMouseWheel() {-->

            <!--if (document.addEventListener) {-->
                <!--document.addEventListener('DOMMouseScroll', scrollFunc, false);-->
            <!--}//W3C-->
            <!--window.onmousewheel = document.onmousewheel = scrollFunc;//IE/Opera/Chrome-->
        <!--}-->
        <!--function scrollFunc(evt) {-->
            <!--return false;-->
        <!--}-->
        <!--window.onload=disabledMouseWheel;-->
    <!--</script>-->


    <script>

        $(document).ready(function () {

// chrome 浏览器直接

 

<script>
    $(document).ready(function () {

// chrome 浏览器直接加上下面这个样式就行了,但是ff不识别  $('body').css('zoom', 'reset');
        $(document).keydown(function (event) {

            //event.metaKey mac的command键
            if ((event.ctrlKey === true || event.metaKey === true)&& (event.which === 61 || event.which === 107 ||

                    event.which === 173 || event.which === 109 || event.which === 187  || event.which === 189)){

                event.preventDefault();    }
        });

        $(window).bind('mousewheel DOMMouseScroll', function (event) {

            if (event.ctrlKey === true || event.metaKey) {

                event.preventDefault();    }  });});

</script>

 

posted @ 2019-04-28 15:54  终究是乌云遮了天  阅读(1509)  评论(0编辑  收藏  举报