我需要手风琴的帮助,让“li”保持打开状态,以便在每个页面加载时显示选定的菜单。每次单击链接时,我都会关闭代码。我需要一个保持“li”打开以显示活动链接的代码。请帮我。这是我的代码:
<ul id="accordion">
<li><a href="#">Individual Inventory</a></li>
<ul class="submenu">
<li><a href="?page=records" title="">Individual Inventory Records</a></li>
<li><a href="?page=repo" title="">Records</a></li>
</ul>
<li><a href="#">Exit Interview</a></li>
<ul class="submenu">
<li><a href="?page=ir">Inventory Records</a></li>
<li><a href="?page=sweet">sweet</a></li>
</ul>
</ul>
:css
#accordion {
list-style: none;
padding: 0 0 0 0;
width: 250px;
}
#accordion li{
display: block;
background:#024b9a url(../images/img05.jpg) repeat;
margin: auto;
cursor: pointer;
padding-top:10px;
list-style: circle;
color:#ffffff;
text-align: center;
height:5px;
}
#accordion li:hover{
opacity:0.8;
filter:alpha(opacity=80);
}
#accordion li:active{
opacity:0.8;
filter:alpha(opacity=80);
}
#accordion ul {
list-style: none;
padding: 0 0 0 0;
display: none;
}
#accordion ul li{
background:#ffffff;
font-weight: normal;
cursor: auto;
padding: 5px 0 10px 7px;
height:10px;
}
#accordion ul li:hover{
background:url(../images/img052.jpg) repeat;
}
#accordion a {
text-decoration: none;
color;#000;
padding:10px;
font-family:Verdana, Geneva, sans-serif;
}
#accordion a:hover {
color;#000;
}
jQuery:
$("#accordion > li ").click(function() {
if(false == $(this).next().is(':visible')) {
$('#accordion > ul').slideUp(300);
}
$(this).next().slideToggle(300);
});