Flash or black background after clicking on the mobile side

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.