Skip to content

Instantly share code, notes, and snippets.

@EvanAgee
Created April 29, 2014 19:34
Show Gist options
  • Select an option

  • Save EvanAgee/11409846 to your computer and use it in GitHub Desktop.

Select an option

Save EvanAgee/11409846 to your computer and use it in GitHub Desktop.
Add hover on touch for mobile devices using jQuery
$("a").live("touchstart", function(e) {
$(this).trigger("hover");
});
$("a").live("touchend", function(e) {
$(this).trigger("blur");
});
@Bucklash
Copy link
Copy Markdown

Bucklash commented May 8, 2015

Hi EvanAgee,
Just saw this, thought I'd comment :)
From the jQuery site:
jQuery version deprecated: 1.7, removed: 1.9
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment