我正在创建一个jQuery手风琴菜单。当单击其中一个子链接时,我需要打开正确的面板。
因此,如果在“咨询”下单击“简介”,用户将转到“简介”页面,“咨询”面板将打开。或者,如果在“RPO”下单击“值”,则当用户进入该页面时,“RPO”面板将保持打开状态等。有没有办法执行此操作?
<ul id="nav-side" class="accordion">
<li class="accordion-title"><a href="#">RPO</a>
<ul>
<li><a href="/rpo/index.php">Value</a></li>
<li><a href="/rpo/solution-competencies.php">Solution Competencies</a></li>
<li><a href="/rpo/rpo-models.php">Defined RPO Models</a></li>
<li><a href="/rpo/program-management.php">Dedicated Program Management</a></li>
<li><a href="/rpo/solution-planning.php">Solution Planning & Implementation</a></li>
</ul>
</li>
<li class="accordion-title"><a href="#">CONSULTING</a>
<ul>
<li><a href="/consulting/index.php">Intro</a></li>
<li><a href="#">#</a></li>
<li><a href="#">#</a></li>
</ul>
</li>
<li class="accordion-title"><a href="#">CRM</a>
<ul>
<li><a href="#">#</a></li>
<li><a href="#">#</a></li>
<li><a href="#">#</a></li>
</ul>
</li>
</ul>
JS:
$(function() {
var icons = {
header: "ui-icon-plusthick",
activeHeader: "ui-icon-minusthick"
};
$( ".accordion" ).accordion({
icons: icons,
heightStyle: "content"
});
$( "#toggle" ).button().click(function() {
if ( $( ".accordion" ).accordion( "option", "icons" ) ) {
$( ".accordion" ).accordion( "option", "icons", null );
} else {
$( ".accordion" ).accordion( "option", "icons", icons );
}
});
});