How to prevent click events on the document body (maybe a bug in Cordova?)

后端 未结 2 1415
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 13:24

I\'m a beginner trying to develop a mobile phone game with with Kinetic Js and \"phonegap build\". I am experiencing a problem which I don\'t know how to address. I made som

2条回答
  •  温柔的废话
    2021-01-04 13:36

    Have you tried this?

    stage.on('tap touchstart touchend', function() {
      return false;
    });
    

    This might help too:

    canvas {
      /*-webkit-tap-highlight-color: transparent; Some users reported this worked for them, although rgba(0,0,0,0); worked for the asker*/
      -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      -khtml-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      outline: none;
    }
    

    Here is a quick link on webkit-touch-callout, I'm not sure if it will help your situation... http://phonegap-tips.com/articles/essential-phonegap-css-webkit-touch-callout.html

    EDIT: It appears the author of phone gap suggests -webkit-tap-highlight-color: rgba(0, 0, 0, 0); to prevent link selection. Source here: https://github.com/phonegap/phonegap-start/blob/master/www/css/index.css

提交回复
热议问题