ios10+禁止缩放

ios10+禁止缩放

ios10+禁止缩放

<!--头部限制 ios10+无效-->
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">

<script>
//ios10+禁止缩放
window.onload = function () {
    document.addEventListener('touchstart', function (event) {
        if (event.touches.length > 1) {
            event.preventDefault();
        }
    }, {
        passive: false  // 关闭被动监听
    });
    var lastTouchEnd = 0;
    document.addEventListener('touchend', function (event) {
        var now = (new Date()).getTime();
        if (now - lastTouchEnd <= 300) {
            event.preventDefault();
        }
        lastTouchEnd = now;
    }, false);
};


window.onload=function () {
    document.addEventListener('touchstart',function (event) {
        if(event.touches.length>1){
            event.preventDefault();
        }
    });
    var lastTouchEnd=0;
    document.addEventListener('touchend',function (event) {
        var now=(new Date()).getTime();
        if(now-lastTouchEnd<=300){
            event.preventDefault();
        }
        lastTouchEnd=now;
    },false);
    document.addEventListener('gesturestart', function (event) {
        event.preventDefault();
    });
}
</script>

留下回复


Warning: is_dir(): open_basedir restriction in effect. File(/www/wwwroot/my-wordpress/index.php/2021/05/31/ios10%E7%A6%81%E6%AD%A2%E7%BC%A9%E6%94%BE/) is not within the allowed path(s): (/www/wwwroot/my-wordpress/:/tmp/) in /www/wwwroot/my-wordpress/wp-content/plugins/matomo/classes/WpMatomo/AIBotTracking.php on line 175