Here my simple accordion :
<script type="text/javascript">
$(function()
{
$("dt.title").click(function()
{
$("div.info").slideUp("slow");
$(this).next("div.info:hidden").slideDown("normal" );
});
});
</script>
And it works fine with the this html :
<body>
<div id="wrapper">
<div id="container">
<ul id="nav">
<dt class="title"><a href="#">About</a></dt>
<dt class="title"><a href="#">Work</a></dt>
<div class="info">
<ul>
<li><a href="#">Bol</a></li>
<li><a href="#">Annie</a></li>
<li><a href="#">Imran</a></li>
</ul>
</div>
<dt class="title"><a href="#">Contact</a></dt>
<dt class="title"><a href="#">Links</a></dt>
</ul>
</div>
<div id="content">
</div>
</div>
</body>
</html>
When I put the href links, the menu stops working. For example :
<dt class="title"><a href="about.html">About</a></dt>
Also tell me how can I add the active and hover state in the menu.
You forgot to
return falseIf you are planning to load the content of
about.htmlincontentelement then useloadmethod. Your function will be something likeBut this will not work for cross-domain url.
[UPDATE]