Skip to content

Instantly share code, notes, and snippets.

@lean8086
Created March 5, 2013 21:18
Show Gist options
  • Save lean8086/5094363 to your computer and use it in GitHub Desktop.
Save lean8086/5094363 to your computer and use it in GitHub Desktop.
Bind multiple *variable events* on jQuery/Zepto
var enter = (mobile ? 'touchstart' : 'mouseenter'),
leave = (mobile ? 'touchend' : 'mouseleave'),
events = {};
events[enter] = function () { ... }
events[leave] = function () { ... }
$('selector').on(events);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment