Adding open/closed icon to Twitter Bootstrap collapsibles (accordions)

后端 未结 19 2470
失恋的感觉
失恋的感觉 2020-12-22 18:23

I\'ve set up this simple version of the Bootstrap accordion:

Simple accordion: http://jsfiddle.net/darrenc/cngPS/

Currently the icon only po

19条回答
  •  佛祖请我去吃肉
    2020-12-22 19:11

    A bootstrap v3 solution (where the events have different names), also using only one jQuery selector (as seen here):

    $('.accordion').on('hide.bs.collapse show.bs.collapse', function (n) {
        $(n.target).siblings('.panel-heading').find('i.glyphicon').toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
    });
    

提交回复
热议问题