gpt4 book ai didi

javascript - 当我们单击 ul 中的列表项时,如何将 fa-angle-left 更改为 fa-angle-down

转载 作者:行者123 更新时间:2023-11-28 04:29:24 27 4
gpt4 key购买 nike

当我们单击 ul 中的列表项下拉列表时,我必须将 fa-angle-left 更改为 fa-angle-down。请引用下面的代码。

<nav>
<ul class="nav nav-pills nav-stacked panel-group " id="accordion" data-spy="affix" data-offset-top="605">
<!--<li class="active"><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>-->
<li class="panel" style="margin-top: 0px">
<a href="javascript:;" data-toggle="collapse" data-target="#demo1" data-parent="#accordion" style="margin-left: 0px; margin-top:"> <i class="fa fa-calendar " style="margin-right: 10px;"></i>Planning<i class="fa fa-angle-left " style="float: right !important;"></i> </a>
<ul id="demo1" class="collapse ">
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
YE
</span><a ui-sref="">Yearly</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
MO
</span><a ui-sref="">Monthly</a></li>
</ul>
</li>
<li class="panel" style="margin-top: 0px">
<a href="javascript:;" data-toggle="collapse" data-target="#demo2" data-parent="#accordion" style="margin-left: 0px; margin-top:"> <i class="fa fa-book " style="margin-right: 10px;"></i>Order<i class="fa fa-angle-left" style="float: right !important;"></i> </a>
<ul id="demo2" class="collapse " data-parent="#accordion">
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px; text-decoration: none ;">
AL
</span><a ui-sref="dashboard">All</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
SE
</span><a ui-sref="sector">Sector</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
DR
</span><a ui-sref="">Date Range</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
DE
</span> <a ui-sref="">Delivered</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
PE
</span><a ui-sref="">Pending</a></li>
</ul>
</li>
<li class="panel" style="margin-top: 0px">
<a href="javascript:;" data-toggle="collapse" data-target="#demo3" data-parent="#accordion" style="margin-left: 0px; margin-top:"> <i class="fa fa-truck" style="margin-right: 10px;"></i>Logistics<i class="fa fa-angle-left" style="float: right !important;"></i> </a>
<ul id="demo3" class="collapse" data-parent="#accordion">
<li style="margin-left: 0px"> <span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
AL
</span><a ui-sref="">All</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
SE
</span><a ui-sref="">Sector</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
CU
</span><a ui-sref="">Customer</a></li><br>
<li style="margin-left: 0px"><span class="thumbnail" style="display:inline;border: 0px solid;background-color:#21252d;color:white;font-size:9px;margin-right: 12px;">
PE
</span><a ui-sref="">Pending</a></li>
</ul>
</li>
<li class="panel" style="margin-top: 0px">
<a href="javascript:;" data-toggle="collapse" data-target="#demo4" style="margin-left: 0px; margin-top:"> <i class="fa fa-truck" style="margin-right: 10px;"></i>Delivery </a>
</li>
<li class="panel" style="margin-top: 0px">
<a href="javascript:;" data-toggle="collapse" data-target="#demo4" style="margin-left: 0px; margin-top:"> <i class="fa fa-truck" style="margin-right: 10px;"></i>Delivery </a>
</li>
</ul>
</nav>

建议我必须做哪些改变才能实现这一点。也请引用 JsFiddle https://jsfiddle.net/ArunKumarUmma/4oyLhsup/1/

最佳答案

我们可以使用 Jquery 本身尝试下面的代码来实现这一点。

<i class="fa fa-angle-left" onClick="($(this)[0].className == 'fa fa-angle-left')?$(this)[0].className='fa fa-angle-down':$(this)[0].className='fa fa-angle-left'" style="float: right !important;"></i>

关于javascript - 当我们单击 ul 中的列表项时,如何将 fa-angle-left 更改为 fa-angle-down,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42290560/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com