Disabling Clicking When Using .fadeout() In Jquery
I am building a card game. When the user clicks the card, the card fades out. However, at the moment, there is a serious bug. The user can click one card multiple times, adding mul
Solution 1:
Try this
$(clicked_id).off().fadeOut('fast');
In case the event is called by inline onclick
:
$(clicked_id).prop("onclick", "").off().fadeOut('fast');
Solution 2:
You should first remove the click event on the element, then do the fade out effect with a callback function which will reattach the click event.
$('#clicked_id').off('click').fadeOut('fast', function () {
$('#clicked_id').on('click');
});
This is completely untested and just a theory but it might work!
Post a Comment for "Disabling Clicking When Using .fadeout() In Jquery"