I have on Bootstrap collapse content, I tried to change the .pannel-heading background when the a[aria-expanded="true] is true.
Also is possible add one more <a> tag in here and won't affect they collapse?
Here's the HTML
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>title </h4>
<button class="button">Sign up</button>
<a data-toggle="collapse" data-parent="#accordion" href="#" class="" aria-expanded="true">sample text</a>
</div>
</div>
<div id="collapse-SortTechnician-1" class="panel-collapse collapse in" aria-expanded="true" style="">
<div class="panel-body">
<div class="block1 block constraint-container no-bg ">
<div class="constrain content-block clearfix">
<div class="richtext ">
<p>sample text</p>
</div>
</div>
</div>
</div>
</div>
</div>
Here's what I tried in jQuery, not working yet.
$(function(){
if ($('.panel-heading .panel-title > a').attr('aria-expanded') === "false") {
alert("false");
$('.panel-title').css('background','#fff');
} else if($('.panel-heading .panel-title > a').attr('aria-expanded') === "true") {
$('.panel-title').css('background','#061544');
alert('true');
}
})
Here's what I tried in CSS, not working yet.
.panel-heading a[aria-expanded="true"] ~ .panel-heading{
background-color: #89c2dc;
color: #fff;
}