how can i disable click event before fadein and enable it after fadeout?
my js code:
$(\'a\').click(function(){
// disable click
$(\'div\').fadeO
Add as the first line of your click callback:
if ($('div').is(':animated')) return;
Add a class to the element, and don't run the event when that class is there.
$('a').click(function () {
var $this = $(this);
if ($this.hasClass('noClick')) return;
// disable click
$this.addClass('noClick');
$('div').fadeOut(400, function () {
$(this).css('background', 'yellow').fadeIn(1800, function () {
// enable click
$this.removeClass('noClick');
});
});
});