Reputation: 303
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?
Upvotes: 6
Views: 9752
Reputation: 1329
Your css is correct but, your css may still be cached, this is something I noticed a bit with iOS 6 UIWebViews, add a url parameter to your link that should fix it after a refresh.
<link href="styles.css?cache=123" rel="stylesheet" />
Upvotes: 0
Reputation: 59273
You could try including e.preventDefault()
in the ontouchstart
handler:
yourElement.ontouchstart = function(e) {
e.preventDefault();
}
Upvotes: 3