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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -