[IOS] highlights of native-like webapp Creation

Source: Internet
Author: User

When you tap a page element, iOS displays an orange outer box around the element to indicate that the element has been tapped. If you want to achieve the effect of the response when you tap, you can use the following method to "Remove" the highlight effect. (Source)

-Webkit-tap-highlight-color: rgba (0, 0, 0 );

Prohibit the user from selecting text on the page: (source)

-Webkit-user-select: none;

If you respond to the onclick event, you will find that the click event has a latency of about half a second, because iOS needs to wait for a while to determine whether the user clicks or drags. To remove this latency, you can useOntouchstartReplaceOnclick(Source)

$ (". Button"). bind ("touchstart", handler );

But in this way, you can click the mouse in the desktop browser to stop using it. It doesn't matter. You can make a judgment.

If ('ontouchstart' in window) {// mobile version $ (". button "). bind ("touchstart", handler);} else {// desktop version $ (". button "). bind ("click", handler );}

Prohibit users from dragging pages: (source)

Document. ontouchstart = function (e) {e. preventDefault ();}

Some Other information: here

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.