Collapse Tree navigation menu instance
<! DOCTYPE html>
<meta charset= "Utf-8" >
<title></title>
<style>
body{font-size:10.5pt;}
dt{
Background: #ccc;
width:500px;
}
</style>
<script src= "Jquery/1.9.0/jquery.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ (' #faq '). Find (' dd '). Hide ();
$ (' #faq '). Find (' DT '). Click (function () {
var answer = $ (this). Next ();
if (answer.is (': Visible ')) {
Answer.slideup ();
} else {
Answer.slidedown ();
}
});
});
</script>
<body>
<DL id= "FAQ" >
<dt> 00 H5 Net </dt>
<dd> Welcome to the 00 H5 Net, hope to provide good advice and advice </dd>
<dt> Front-End Tutorials </dt>
<DD>CSS3 Tutorials </dd>
<dt>php Tutorials </dt>
<dd> the address of this site is www.00h5.com</dd>
</dl>
</body>
. $ (document). Ready (function () {}), when the document structure is fully loaded and then executes the code in the function.
. $ (' #faq '). Find (' dd '). Hide () hides the DD element, which is the two-level menu.
. $ (' #faq '). Find (' DT '). Click (function () {}), register the click event handler for the DT element.
. var answer = $ (this). Next (), gets the next element of the click Element, in this code is the DD element behind the DT element.
. if (answer.is (': Visible ')) {
Answer.slideup ();
} else {
Answer.slidedown ();
}, determines whether the element is displayed and is animated if it is displayed.
00 H5
Otherwise, just pull down the animation mode.
Collapse Tree navigation Menu instance