-webkit-user-select:none; - 没有工作 [英] -webkit-user-select: none; - not working

查看:608
本文介绍了-webkit-user-select:none; - 没有工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个将在iPad上查看的网站,并且我试图防止在用户触摸并保留图像时出现复制和粘贴泡泡,因为我希望发生ontouchstart和ontouchend 。



这是我的html

 < img class = appImgsrc =img / fundMobile.jpg/> 

这是我的css

  .appImg {
-webkit-user-select:none;
}

一旦我按住iPad,泡泡仍会出现。如何解决这个问题的任何想法? 您可以尝试包括 e.preventDefault() code> ontouchstart 处理程序:

  yourElement.ontouchstart = function(e){
e.preventDefault();
}


I'm creating a site that will be viewed on the iPad and I'm trying to prevent the copy and paste bubble from appearing when the user touches and holds on an image because I'd like something to happen ontouchstart and ontouchend.

Here is my html

<img class="appImg" src="img/fundMobile.jpg" />

Here is my css

.appImg{        
    -webkit-user-select: none;
}

Once I press and hold on my iPad the bubble still appears. Any ideas on how to fix this?

解决方案

You could try including e.preventDefault() in the ontouchstart handler:

yourElement.ontouchstart = function(e) {
  e.preventDefault();
}

这篇关于-webkit-user-select:none; - 没有工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆