Twitter bootstrap: adding a class to the open accordion title

前端 未结 11 866
-上瘾入骨i
-上瘾入骨i 2020-12-08 15:58

I am a jquery/javascript newbie. What I want to do is add a class to the open accordion title, and remove it when i open another.

heres the code:

&l         


        
11条回答
  •  青春惊慌失措
    2020-12-08 16:35

    I think it would work if you put this on your javascript:

    $('.accordion-toggle').on('shown', function () {
     $(this).addClass('active') });
    
    $('.accordion-toggle').on('hidden', function () {
     $(this).removeClass('active') });
    

提交回复
热议问题