请帮助我:
我有这个折叠菜单和子菜单:
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<div class="level1" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
My Interests <i class="fa fa-chevron-right pull-right img-panel-1"></i>
</div>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div class="sub-menus">
<div class="panel-1-1" href="#sub1" data-toggle="collapse">
MY MOVIES <i class="fa fa-chevron-right pull-right img-panel_1_1"></i>
</div>
<div class="collapse" id="sub1">
<a href="#">
Action
</a>
<hr>
<a href="#">
dventure
</a>
<hr>
<a href="#">
Add / Remove
</a>
</div>
<br>
<div class="panel-1-2" href="#sub2" data-toggle="collapse">
MY CHANNELS <i class="fa fa-chevron-right pull-right img-panel_1_2"></i>
</div>
<div class="collapse" id="sub2">
<a href="#">
80's Rock
</a>
<hr>
<a href="#">
Hip Hop
</a>
<hr>
<a href="#">
Add / Remove
</a>
</div>
</div>
</div>
</div>
我正在使用这些事件来更改链接(折叠项目)的箭头图像点击:
$('.panel-1').on('hidden.bs.collapse', function () {
$('.img-panel-1').toggleClass('fa-chevron-right fa-chevron-down');
});
$('.panel-1').on('shown.bs.collapse', function () {
$('.img-panel-1').toggleClass('fa-chevron-right fa-chevron-down');
});
$('#collapseOne').on('hidden.bs.collapse', function () {
$('.img-panel_1_1').toggleClass('fa-chevron-right fa-chevron-down');
});
$('#collapseOne').on('shown.bs.collapse', function () {
$('.img-panel_1_1').toggleClass('fa-chevron-right fa-chevron-down');
});
$('#collapseOne').on('hidden.bs.collapse', function () {
$('.img-panel_1_2').toggleClass('fa-chevron-right fa-chevron-down');
});
$('#collapseOne').on('shown.bs.collapse', function () {
$('.img-panel_1_2').toggleClass('fa-chevron-right fa-chevron-down');
});
但是,当我点击任何链接(折叠项目)时,所有图像都会发生变化,同时将事件应用于菜单和子菜单,我需要在单击时仅在菜单中更改图像,如果仅单击此图像则需要更改子菜单
Here you can see what happen with this arrows
感谢。
答案 0 :(得分:0)