Prevent iOS safari from moving web-page window so drag event can happen

后端 未结 3 844
暗喜
暗喜 2021-02-05 16:56

I am using Pep.js for kinetic drag on multi-touch, but my drag events are not being registered because when I try to drag an object in the safari, on iOS, window the window itse

相关标签:
3条回答
  • 2021-02-05 17:27

    I have found this solution while working with the #ionicframework

    CSS:

    html, body {
      overflow:hidden;
    }
    

    JS:

    $(window).bind(
      'touchmove',
       function(e) {
        e.preventDefault();
      }
    );
    
    0 讨论(0)
  • 2021-02-05 17:38

    Try to add

    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
    

    To head tag in your html

    0 讨论(0)
  • 2021-02-05 17:46

    Your animation is what is causing the issue.

    Well, the class your animation is being applied to.

    Remove the class after the animation is done.

    setTimeout(function(){
        $('#tabViewWindow').removeClass('animated').removeClass('bounceInRight');
    }, 1200);
    

    Also, to disable scrolling on the window:

    html, body{
        overflow:hidden;
    }
    
    0 讨论(0)
提交回复
热议问题