Skip to content

Instantly share code, notes, and snippets.

@yeikos
Created July 18, 2012 12:14
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 yeikos/3135853 to your computer and use it in GitHub Desktop.
Save yeikos/3135853 to your computer and use it in GitHub Desktop.
Controlando la ejecución simultánea de los eventos click y focus
// http://www.yeikos.com/2012/07/controlando-la-ejecucion-simultanea-de-los-eventos-click-y-focus.html
$(function() {
var mutex;
$('#target').on('click focus', function(event) {
if (mutex) {
mutex = false;
return;
}
console.log(event.type);
}).on('mousedown', function() {
if (!$(this).is(':focus'))
mutex = true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment