How to toggle active class on Foundation's section/accordion -
can suggest way toggle active class on foundation's section (accordion). tried following collapse open accordion tab:
$( "p.title" ).click(function() { if ($(this).parent().hasclass("active")) { $(this).parent().removeclass("active"); } }); however, reverts expanded state.
your idea fine. have prevent original foundation handler handle click after handled it.
with code foundation handler gets called after handler. doesn't find active tag anymore , adds again. code should this:
$( "p.title" ).click(function() { if ($(this).parent().hasclass("active")) { $(this).parent().removeclass("active"); return false; // prevents further propagation of event } });
Comments
Post a Comment