Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-webkit-user-select: none; - not working

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?

like image 429
michelle Avatar asked Nov 24 '22 23:11

michelle


1 Answers

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

yourElement.ontouchstart = function(e) {
  e.preventDefault();
}
like image 107
tckmn Avatar answered Nov 27 '22 01:11

tckmn