javascript - accordion toggle not change icon in bootstrap 3 -
i have code multiple/dynamic accordion toggle using bootstrap 3 , jquery:
$('div.accordion-body').on('shown', function () { $(this).parent("div").find(".fa").removeclass("fa fa fa-plus").addclass("fa fa-minus"); }); $('div.accordion-body').on('hidden', function () { $(this).parent("div").find(".fa").removeclass("fa fa-minus").addclass("fa fa fa-plus"); });
but in bootstrap 3 change icon(fa-plus
fa-minus
) not work. how fix ?!
bootstrap 3 demo
beacuse in bootstrap 3 events
shown
, hidden
have been changed show.bs.collapse
, hide.bs.collapse
:
$('div.accordion-body').on('show.bs.collapse', function () { $(this).parent("div").find(".fa").removeclass("fa fa fa-plus").addclass("fa fa-minus"); }); $('div.accordion-body').on('hide.bs.collapse', function () { $(this).parent("div").find(".fa").removeclass("fa fa-minus").addclass("fa fa fa-plus"); });
Comments
Post a Comment