Skip to content

Instantly share code, notes, and snippets.

@mckamey
Created June 13, 2012 23:08
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mckamey/2927073 to your computer and use it in GitHub Desktop.
Save mckamey/2927073 to your computer and use it in GitHub Desktop.
Polyfill for touch dblclick
@matthijn
Copy link

Where is the like button when you need it :)

@philmander
Copy link

philmander commented Oct 8, 2016

This code is still useful for iOS, but I found that on Chrome 53 for Android, the dblclick event is supported and the polyfill causes dblclicks to run twice. This code:

if (!('ontouchstart' in elem)) {
   // non-touch has native dblclick and no need for polyfill
   return; 
}

...evaluates to false. I'm using this check instead:

if(elem.ondblclick === undefined) {

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