HTML and CSS Reference
In-Depth Information
example 5.4: using jQuery to toggle a hidden menu
<!DOCTYPE html>
<title>Example 5.4</title>
<script src=""></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;
<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>
Search WWH ::

Custom Search