J. Doe J. Doe - 11 months ago 36
jQuery Question

jQuery hamburger menu - multiple events called

$( document ).on( "vclick", '#icon', function() {

$("#navigation").animate({height: 'toggle'}, 600, "linear");



I currently have a hamburger menu that works perfectly except for one thing. If I click the
10 times, it will execute the code 10 times, I wonder if its possible to make it only clickable when its finished and remove the whole queue system.

Thanks in advance.


You could probably do something in the lines of this:


var animating = false;
$(document).on( "vclick", '#icon', function() {
   if(!animating) {
      animating = true;
      $("#navigation").animate({height: 'toggle'}, 600, "linear", function() {
         animating = false;