Skip to content

Instantly share code, notes, and snippets.

@yeikos
Created February 5, 2013 11:16
Show Gist options
  • Save yeikos/4713807 to your computer and use it in GitHub Desktop.
Save yeikos/4713807 to your computer and use it in GitHub Desktop.
// 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