我做了这个教程:
http://michaeljacobdavis.com/tutorials/statesavingaccordion.html 这里是演示页面: http: //michaeljacobdavis.com/tutorials/statesavingaccordion/statesavingaccordion.html#1
我把它连接得很好,但是当用户第一次访问该站点时,我不希望第一个菜单项打开(关于)。我希望关闭所有主菜单项,以便用户在单击一个之前无法看到子导航项。我试过但无法弄清楚如何做到这一点 - 请帮忙。下面是代码 - 关于部分总是在网站首次打开时打开 - 我希望它关闭。
<script type="text/javascript">
jQuery().ready(function(){
$('#navbar').accordion({
autoHeight: false,
navigation: true,
header: '.navbaritem'
});
$(".navbaritem").click(function(event){
window.location.hash=this.hash;
});
});
</script>
<div id="navbar">
<div id="logo"> <a href="index.html"><img src="images/logo.png" width="234" height="191" border="0" /></a></div>
<div class="navitemback">
<a class="navbaritem" href="#about" title="First Menu Item" name="about">about</a>
<div>
<p><a href="#why">why we do it</a></p>
<p><a href="#press">press/awards</a></p>
<p><a href="#bio">bio</a></p>
</div>
</div>
<div class="navitemback">
<a class="navbaritem" href="#commercial" title="Second Menu Item" name="commercial">commercial</a>
<div>
<p><a href="#olivers">olivers</a></p>
<p><a href="#lemonade">lemonade</a></p>
<p><a href="#court">court</a></p>
<p><a href="#macks">macks</a></p>
</div>
</div>
<div class="navitemback">
<a class="navbaritem" href="#residential" title="Third Menu Item" name="residential">residential</a>
<div>
<p><a href="#city">city</a></p>
<p><a href="#states">states</a></p>
<p><a href="#country">country</a></p>
</div>
</div>