J. Doe J. Doe - 1 year ago 66
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.

Answer Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download