I'm trying to create a dynamic menu using jQuery, so I've built a basic one and I'm having problems making it look more impressive. At the moment, I can click on an item and the contents will be displayed above the rest of them. I want the content to slide down underneath an item, so it doesn't cover up the other items.
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#historyMenuTitle").click(function(){
if ($("#historyMenu").is(":hidden")){
$("#awardsMenu").slideUp("slow");
$("#historyMenu").slideDown("slow");
}
else{
$("#historyMenu").slideUp("slow");
}
});
$("#awardsMenuTitle").click(function(){
if ($("#awardsMenu").is(":hidden")){
$("#awardsMenu").slideDown("slow");
}
else{
$("#awardsMenu").slideUp("slow");
}
});
$("#galleryMenuTitle").click(function(){
if ($("#galleryMenu").is(":hidden")){
$("#historyMenu").slideUp("slow");
$("#galleryMenu").slideDown("slow");
}
else{
$("#galleryMenu").slideUp("slow");
}
});
});
</script>
<div id="menu">
<div id="historyContainer">
<div id="historyMenuTitle">Our History</div>
<div id="historyMenu"><a href="Our_team.php">Our Team (Committee, Designers & Staff)</a><br />
<a href="Supporters_and_sponsers.php">Our Supporters & Sponsors</a></div>
</div>
<div id="awardsContainer">
<div id="awardsMenuTitle">AWARDS</div>
<div id="awardsMenu"><a href="">ABC</a><a href="">ABC</a><br />
<a href="">ABC</a><br />
ABC<br/>
<a href="">ABC</a><br />
<a href="">ABC</a></div>
</div>
</div>
<div id="galleryContainer">
<div id="galleryMenuTitle">Gallery</div>
<div id="galleryMenu"><a href="">ABC</a><a href="">ABC</a><a href="">ABC</a><a href="">ABC</a></div>
</div>
</div>
#menu {
position:absolute;
top:75px;
left:0px;
width:15%;
height:auto;
}
#historyContainer {
position:absolute;
top:0px;
left:0px;
width:100%;
height:auto;
z-index:3;
}
#historyMenuTitle {
height:auto;
width:200px;
background-color:#ffffff;
display:block;
color:#0000FF;
font-size:24px;
font-weight:bold;
cursor:pointer;
z-index:3;
}
#historyMenu {
height:auto;
width:200px;
background-color:#ffffff;
display:none;
z-index:3;
}
#awardsContainer {
position:absolute;
top:40px;
left:0px;
height:auto;
width:100%;
z-index:2;
}
#awardsMenuTitle {
height:auto;
width:150px;
background-color:#ffffff;
display:block;
color:#0000FF;
font-size:24px;
font-weight:bold;
cursor:pointer;
z-index:2;
}
#awardsMenu {
height:auto;
width:150px;
background-color:#ffffff;
display:none;
z-index:2;
}
#galleryContainer {
position:absolute;
top:160px;
left:0px;
width:100%;
height:auto;
z-index:1;
}
#galleryMenuTitle {
height:auto;
width:150px;
background-color:#ffffff;
display:block;
color:#0000FF;
font-size:24px;
font-weight:bold;
cursor:pointer;
z-index:1;
}
#galleryMenu {
height:auto;
width:150px;
background-color:#ffffff;
display:none;
z-index:1;
}
Any idea what I need to do?
Cheers,