Skip to content

Instantly share code, notes, and snippets.

@lyonsun
Last active December 31, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyonsun/7938752 to your computer and use it in GitHub Desktop.
Save lyonsun/7938752 to your computer and use it in GitHub Desktop.
prevent anchor link drag-drop and redirect link on touch screen.
// prevent text selection in IE
document.onselectstart = function () { return false; };
// prevent anchor link drag.
$('selector').mousedown(function(event) {
event.preventDefault();
});
// redirect link.
$('selector').mouseup(function(event) {
location.href = $(this).parent().attr('href');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment