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

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -