jquery - On click, slide div down and change button icon -


i want slide div down top of page when clicking button - , change icon on button. on clicking again, want div slide (off page) change button icon it's original state.

i have div set display:none, slides down fine , button changes icon slide place disappears! how can stop , slide on clicking again?

here's attempt:

$('.menu-up').on('click', function(e) {     $( ".icon-bar" ).slidedown( "slow", function() {         // animation complete.     });      $(this).toggleclass("menu-up menu-down")     e.preventdefault(); }); 

use slidetoggle instead.

demo

$('.menu-up').on('click', function(e) {     $( ".icon-bar" ).slidetoggle( "slow", function() {         // animation complete.     });     $(this).toggleclass("menu-up menu-down")     e.preventdefault(); }); 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -