Created
July 18, 2012 12:14
-
-
Save yeikos/3135853 to your computer and use it in GitHub Desktop.
Controlando la ejecución simultánea de los eventos click y focus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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