Body binding on iOS device Click event does not take effect and its solution

Source: Internet
Author: User
Event background:

Recently when doing a mobile business encounter a bug, on iOS on the body binding click Thing Implementation Event Agent bubbling to some elements on altogether does not take effect.

Thinking:

Using jquery to show the event binding code, all tags containing the data-tip attribute are proxied to the body through the event

$ (' body '). On (' click ', ' [Data-tip] ',function(e) {   console.log ($). attr (' Data-tip '))     })

This can be done on both Android and PC, but it does not work on some of the tags altogether on iOS. such as TR, span ... Such a label

Workaround:

1. Switch the Click event to the touch event while also addressing the 300ms click Latency issue, but it is cumbersome to e.stoppropagation () to prevent bubbling processing.

2. Perform an event binding on an element that does not normally bubble, such as a TR can perform an event proxy on <table> again.

3. The simplest way to add a Cursor:pointer property to a CSS property of an element that does not normally bubble.

4. Change to a label that can bubble normally.

Body binding on iOS device Click event does not take effect and its solution

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.