Run on ipad with PhoneGap and find that when you click on some of the DOM with the event, there is a blink of an instant and a black background appears when you click on a tag. Home, the blink of an instant is how to appear, the specific reason is not very clear, according to my test, it seems that the DOM is because there are selectable text, so that the DOM is the whole can be touch, in the ipad, the element is touch will appear highlighted, is a translucent black background. So when we click each time, will appear to see the blink of an instant. That's where we're going to handle the touch and click events.
$ ("#id"). Bind ("Touchstart click", Function (e) { e.stoppropagation () if (e.originalevent.touches) { // Touch Event processing return false; } else{ //Click event handling } })
The above is just a simple process of judging if it is touch, and if so, then touch does not support click, because when the ipad touches the finger, execution click also performs touch. The appeal is just a simple way to deal with the way, we should judge the client source information, determine whether it is mobile device side. The corresponding events are then bound.
The top part of the solution is at least a black highlight of the background. is not valid for the a tag. So how does a tag handle it?
About a tags: we can only use the convenient and easy CSS3 to deal with
. class{ -webkit-tap-highlight-color:transparent; }
Set it to transparent, solve!
Flash or black background after clicking on the mobile side