0

I'm new on Jquery and I want to change the title style of my bootstrap accordion only when the accordion collapse (and comeback to my start style when the accordion is closed.

I want to change is 'font-weight' (light to bold) and the color of the title.

I tried to use only css using: .titleClass:collapsed {color: black; font-weight: bold; } but it act on the reverse : it puts my new style when closed and come to my original style when opened (how weird).

So I decided to use Jquery. Here is my stucking problem : With simple selectors I change the title style when collapsed but it doesn't want to come back to my original style when it's closed.

Many thanks for helping me on this. I put a jsfid on comment for whole code.

Here is my js :

$(function() {
    $('#headingOne').click(function(){
    $('.grey-letters').css({'font-weight':'bold', 'color':'black'});
    });
    if('.collapsed'){
        $('.grey-letters').css({'font-weight':'100', 'color':'grey'});
    }

});

Kat
  • 161
  • 1
  • 4
  • 14
  • all code here : https://jsfiddle.net/#&togetherjs=lz8LiiArLA – Kat Mar 10 '17 at 20:24
  • I found the problem, every thing is solved : It was'nt a jquery problem and it's pretty good to know : the h4+bootstrap style made an overide of what I tried to do. I found the result thanks to this strackoverflow page where @idoliki proposed a very efficient styling for the accordion : http://stackoverflow.com/questions/25458074/bootstrap-3-collapse-adding-active-class-to-open-panel – Kat Mar 11 '17 at 12:05

0 Answers0