I'm writing a web app that uses an HTML5 canvas and testing on a Nexus Galaxy. When the user taps on the canvas, it highlights teal for a second, even though I am calling preventDefault() on the touchstart event. I have also tried some CSS rules. How do I disable this brief highlighting?
Setting the CSS rule -webkit-tap-highlight-color
to transparent
on the canvas seemed to do the trick for me.
Note that I also did preventDefault and stopPropagation, so one of those might have had an effect too.
来源:https://stackoverflow.com/questions/9254252/how-to-disable-highlighting-of-a-canvas-on-tap-for-nexus-galaxy