Created
April 26, 2012 03:10
-
-
Save benjamincharity/2495411 to your computer and use it in GitHub Desktop.
Use touchend to get faster links on touch devices
This file contains hidden or 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
var links = document.getElementsByTagName("a"); | |
for (var i=0; i < links.length; i++) { | |
var link = links[i]; | |
link.addEventListener("click", function(e) { | |
e.preventDefault(); | |
}); | |
link.addEventListener("touchend", function() { | |
document.location = this.href; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment