Created
April 18, 2012 04:38
-
-
Save james2doyle/2411137 to your computer and use it in GitHub Desktop.
add touch style pseudo class to touch-ed elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//remove tap-highlight-color from all in css | |
// a[data-active] { /* here are your styles */ } | |
element.addEventListener("touchstart", function (event) { | |
if (event.target.setAttribute) { | |
event.target.setAttribute("data-active", ""); | |
} | |
}, true); | |
element.addEventListener("touchend", function (event) { | |
if (event.target.removeAttribute) { | |
event.target.removeAttribute("data-active"); | |
} | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment