How to simulate :active css pseudo class in android on non-link elements?

Posted by chas s. on Stack Overflow See other posts from Stack Overflow or by chas s.
Published on 2011-02-09T01:16:57Z Indexed on 2012/04/07 23:29 UTC
Read the original article Hit count: 157

Filed under:
|
|

I'd like to be able to mimic the behavior of the :active pseudo class on all elements in Android webkit. Currently, the :active syntax only works on a elements (links). Nearly all of the actionable elements in the app I'm working on are something other than a standard link tag. iOS webkit supports :active on all elements.

/* works on both android iOS webkit */
a:active {
    color: blue;
}
/* works on iOS webkit, does not work on android webkit */
div:active {
    color: red;
}

I've found a couple of resources [1,2] that solve similar problems, but they're both a bit heavy, and I'm wondering if there's a lighter weight solution that I'm just not able to find.

  1. http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone
  2. http://code.google.com/intl/ro-RO/mobile/articles/fast_buttons.html

© Stack Overflow or respective owner

Related posts about android

Related posts about css