HTML and CSS Reference
In-Depth Information
example 5.4: using jQuery to toggle a hidden menu
<!DOCTYPE html>
<html>
<head>
<title>Example 5.4</title>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<style type="text/css">
#state-choice {
position: relative; /* to contain the drop element */
}
#state-choice h4:hover {
cursor: pointer; /* change the pointer on mouseover */
}
#states {
display: none; /* initial state is hidden */
position: absolute;
top: 1.2em; /* move the links below the heading */
padding: .5em;
background-color: white; /* need to cover of other content */
border: thin solid;
}
#states a {
display: block; /* we don't get any breaks around here */
padding-top: .25em;
font-size: small;
}
</style>
</head>
<body>
<div id="state-choice">
<h4 onclick="$('#states').toggle('slow');"> Choose your state </h4>
<div id="states">
<a href="award.html"> Excited </a>
<a href="help.html"> Confused </a>
<a href="restart.html"> Disappointed </a>
<a href="loser.html"> Angry </a>
</div>
 
Search WWH ::




Custom Search