Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koentjuh1/0011c72fa3fccfa0eb77e93c49813125 to your computer and use it in GitHub Desktop.
Save koentjuh1/0011c72fa3fccfa0eb77e93c49813125 to your computer and use it in GitHub Desktop.
Add remove class with different delay
$('.mainmenu-toggle').click(function(){
if($(this).hasClass('mainmenu-toggle-open')){
$(this).delay(200).queue(function(reset_delay){
$(this).removeClass('mainmenu-toggle-open');
reset_delay();
});
} else {
$(this).delay(700).queue(function(reset_delay){
$(this).addClass('mainmenu-toggle-open');
reset_delay();
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment