I am struggling to create an accordion menu that toggles open and close using the same button.
Right now, it only opens and I cannot figure out how to make it close as well.
Below is my current code, or you can view it on jsFiddle: http://jsfiddle.net/ndczc728/5/
//Accordion
(function($) {
var allPanels = $('ul.sub-level').hide();
$('.click-me').click(function() {
$this = $(this);
$target = $this.next();
if(!$target.hasClass('active')){
allPanels.removeClass('active').slideUp();
$target.addClass('active').slideDown();
}
return false;
});
})(jQuery);