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

后端 未结 19 2472
失恋的感觉
失恋的感觉 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:00

    This has been answered by numerous ways but what I came up with was the simplest and easiest for me with Bootstrap 3 and font awesome. I just did

    $('a.toggler').on('click', function () {$('i', this).toggleClass('fa-caret-up');});
    

    This just toggles the CSS class of the icon I want to show. I add the class toggler to the item I want to apply this to. This can be added onto any item you want to toggle an icon.

提交回复
热议问题