这就是我所做的,这里是用作显示手风琴触发器的水平条。(我已替换为 )
<ul id="zoneSlider">
<li class="legacy_slider" style="width: 300px; height: 131px; float: left; display: block; background: #c11e07;">
<div onclick="OperateAccordion(1)"; class="flex-caption_slider" style="background: #c11e07; height: 131px;">End the wait</div>
</li>
<li class="legacy_slider" style="width: 300px; height: 131px; float: left; display: block; background: #ff9400;">
<div onclick="OperateAccordion(2)"; class="flex-caption_slider" style="background: #ff9400; height: 131px;">Intelligence @ the sales floor</div>
</li>
<li class="legacy_slider" style="width: 300px; height: 131px; float: left; display: block; background: #0ea913;">
<div onclick="OperateAccordion(3)"; class="flex-caption_slider" style="background: #0ea913; height: 131px;">Helping store associates do more with less</div>
</li>
<li class="legacy_slider" style="width: 300px; height: 131px; float: left; display: block; background: #00a9ec;">
<div onclick="OperateAccordion(4)"; class="flex-caption_slider" style="background: #00a9ec; height: 131px;">Let's help save water</div>
</li>
</ul>
然后我使用了单独的手风琴:
<div class="accordion" id="accordion1">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne">END THE WAIT
</a>
</div>
<div id="collapseOne" class="accordion-body collapse" style="height: 0px;">
<div class="accordion-inner">
</div>
</div>
</div>
</div>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordio2" href="#collapseTwo">END THE WAIT
</a>
</div>
<div id="collapseTwo" class="accordion-body collapse" style="height: 0px;">
<div class="accordion-inner">
</div>
</div>
</div>
</div>
<div class="accordion" id="accordion3">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordio3" href="#collapseThree">END THE WAIT
</a>
</div>
<div id="collapseThree" class="accordion-body collapse" style="height: 0px;">
<div class="accordion-inner">
</div>
</div>
</div>
</div>
以下是我用来控制显示的JS:
<script language="javascript">
$(document).ready(function () {
$('#accordion2').hide();
$('#accordion3').hide();
$('#accordion4').hide();
$('#accordion5').hide();
});
function OperateAccordion(index) {
if (index == 1) {
$('#accordion3').hide();
$('#accordion4').hide();
$('#accordion5').hide();
$('#accordion2').show();
}
else if (index == 2) {
$('#accordion2').hide();
$('#accordion4').hide();
$('#accordion5').hide();
$('#accordion3').show();
}
else if (index == 3) {
$('#accordion2').hide();
$('#accordion3').hide();
$('#accordion5').hide();
$('#accordion4').show();
//$("#accordion3").collapse();
}
else if (index == 4) {
$('#accordion2').hide();
$('#accordion3').hide();
$('#accordion4').hide();
$('#accordion5').show();
}
}
</script>
现在这可以满足我的要求,除了一件事。手风琴在显示时应展开。现在它在显示时已折叠。如何做到这一点?
另外,我不确定我是否以最好的方式做到这一点,所以如果你能提出更好的选择,我将不胜感激。