How can I block every second click on the link?
That is, the user clicks on the link - the block crashes, then closes. The user clicks again on the link - the block does not crash. The user clicks the link again, and the block crashes again. And so on.

$('.win').click(function() { $('.sage').slideDown('fast'); $('.sage').delay(0).slideUp('fast'); }); 

Feeddle

    1 answer 1

    The easiest way is to use the flag:

     var toShow = true; $('.win').click(function() { if (toShow) { $('.sage').slideDown('fast'); $('.sage').delay(0).slideUp('fast'); } toShow = !toShow; }); 

    An example in fiddle .

    • Thank you very much. - gm-111
    • @ gm-111 on health. - Regent