Twitter Bootstrap accordion icon doesnt change

前端 未结 5 1264
借酒劲吻你
借酒劲吻你 2020-12-13 20:50

I have this accordion thing from bootstrap. The arrow icons point down.

\"enter

5条回答
  •  抹茶落季
    2020-12-13 21:31

    This is a bug in bootstrap. If you inspect your markup when you toggle one of the headings that has a class of .accordion-toggle it toggles it from having the class collapsed or not. When you click a different heading to the one that is open though it doesn't add the class of collapsed onto the heading of the open element. This fixed it for me:

    $('.accordion-toggle').click(function() {
        if($(this).hasClass('collapsed')) {
            $('.accordion-toggle').not(this).addClass('collapsed');
        }
    });
    

提交回复
热议问题