試圖風格化bs3手風琴......我爲標題和正文添加了一個圖像。我設法在懸停和/或打開時設置關閉和藍色文本的黑色標題文本。Bootstrap 3手風琴開啓/關閉造型
如何更改懸停和/或打開時「面板標題」的背景顏色?我嘗試了很多沒有結果的事情。這是否會通過添加/刪除樣式成爲jquery唯一的解決方案?
<div class="panel panel-faq">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#accordion1_2">
1. Some title goes here
</a>
</h4>
</div>
<div id="accordion1_2" class="panel-collapse collapse">
<div class="panel-body">
sample entry text goes here
</div>
</div>
</div>
.panel-faq{
border-color: #dddddd;
}
.panel-faq .panel-heading {
color: #333333;
background:#f5f5f5 url('/assets/img/faq-question.png') no-repeat 10px center;
padding-left: 45px;
border-color: #dddddd;
}
.panel-default > .panel-heading + .panel-collapse .panel-body {
border-top-color: #dddddd;
}
.panel-default > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #dddddd;
}
.panel-faq .panel-body {
background: url('/assets/img/faq-answer.png') no-repeat 40px 20px;
padding-left: 75px;
}
.panel-faq .accordion-toggle, .panel-faq a.accordion-toggle:hover{
color:#428bca;
text-decoration:none;
}
.panel-faq .accordion-toggle.collapsed {
color:#333333;
}
謝謝。我可以補充的是,如果你想在開始時打開一個,你需要手動將'collapse'類添加到該面板div標記的HTML中。 – Steve
謝謝 - 這是非常有用的 –
我有幾個面板來管理,所以我修改了一下代碼,最後得到:$('。classofacordord.panel')。on('show.bs.collapse',function (){ $(this).addClass('active'); }); ('.classofacordord.panel')。('hide.bs.collapse',function(){ $(this).removeClass('active'); }); – madagalbiati