HTML标记是:
<ul class="topMenu" style="padding-top: 35px;">
<li class="acB"><span><a id="configure" title="Configure">CONFIGURE </a></span></li>
<li><span><a id="accounts" title="Accounts">ACCOUNTS</a> </span></li>
<li><span><a id="forwarding" title="Forwarding">FORWARDING</a></span></li>
<li><span><a id="container_track" title="Container Track">CONTAINER TRACK</a></span></li>
<li><span><a id="fleet_management" title="Fleet Management">FLEET MANAGEMENT</a> </span></li>
而css类是:
.topMenu li.acB
{
color: #fff;
background-color: #F36501;
border-bottom: 1px solid #4F556B;
}
我可以突出显示选定的菜单吗?
JS代码是(jquery: used):
$("#accounts").closest('ul').find('.acB').removeClass('acB');
$("#accounts").parents().addClass('acB');
$("#accounts").parent().children().removeClass('acB');
我们可以创建一个变量来完成上述过程并声明菜单级别吗?