I don't know. I don't know. The active attribute of the link in iOS development and web pages is invalid. But today, I found that a hack method can make the CSS active effective.

Source: Internet
Author: User

It's amazing. It's also accidental.

We always think that it is normal that active on mobile devices is invalid, because there is no mousedown, is it touch?

Today, we found that to make the CSS active pseudo-class of the link take effect, you only need to bind an empty anonymous method to touchstart/touchend of any event of the touch series of the a link to hack success.

<Style>

A {

Color: #000;

}

A: active {

Color: # FFF;

}

</Style>

<A herf = "asdasd"> asdasd </a>

<SCRIPT>

VaR A = Document. getelementsbytagname ('A ');

For (VAR I = 0; I <A. length; I ++ ){

A [I]. addeventlistener ('touchstart', function () {}, false );

}

</SCRIPT>

Try an iPad or iPhone,

Amazing discovery: After the touch press down, it turns out that the active effect of A has taken effect ...!!!

Related Article

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.