Jquery CSS navigation drop-down menu code

Source: Internet
Author: User
The code is as follows: Copy code

 

<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html>
<Head>
<Title> scaling menu, rewritten with toggle () </title>
<Style>
<! --
Body {
Background-color: # ffdee0;
}
# Navigation {
Width: 200px;
Font-family: arial;
}
# Navigation> ul {
List-style-type: none;/* do not display the project symbol */
Margin: 0px;
Padding: 0px;
}
# Navigation> ul> li {
Border-bottom: 1px solid # ed9f9f;/* Add underline */
}
# Navigation> ul> li> {
Display: block;/* block display */
Padding: 5px 5px 5px 0.5em;
Text-decoration: none;
Border-left: 12px solid #711515;/* rough red edge on the left */
Border-right: 1px solid #711515;/* shadow on the right */
}
# Navigation> ul> li> a: link, # navigation> ul> li> a: visited {
Background-color: # c11136;
Color: # ffffff;
}
# Navigation> ul> li> a: hover {/* when the mouse passes */
Background-color: #990020;/* change the background color */
Color: # ffff00;/* change the text color */
}
/* Submenu css style */
# Navigation ul li ul {
List-style-type: none;
Margin: 0px;
Padding: 0px 0px 0px 0px;
}
# Navigation ul li {
Border-top: 1px solid # ed9f9f;
}
# Navigation ul li {
Display: block;
Padding: 3px 3px 3px 0.5em;
Text-decoration: none;
Border-left: 28px solid # a71f1f;
Border-right: 1px solid #711515;
}
# Navigation ul li a: link, # navigation ul li a: visited {
Background-color: # e85070;
Color: # ffffff;
}
# Navigation ul li a: hover {
Background-color: # c2425d;
Color: # ffff00;
}
-->
</Style>
<Script language = "webpage effects" src = "jquery. min. js"> </script>
<Script language = "javascript">
$ (Function (){
$ ("Li"). find ("ul"). prev (). click (function (){
$ (This). next (). toggle ();
});
$ ("Li: has (ul)"). find ("ul"). hide ();
});
</Script>
</Head>
<Body>
<Div id = "navigation">
<Ul id = "listul">
<Li> <a href = "#"> home </a> </li>
<Li> <a href = "#"> news </a>
<Ul>
<Li> <a href = "#"> lastest news </a> </li>
<Li> <a href = "#"> all news </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> sports </a>
<Ul>
<Li> <a href = "#"> basketball </a> </li>
<Li> <a href = "#"> football </a> </li>
<Li> <a href = "#"> volleyball </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> weather </a>
<Ul>
<Li> <a href = "#"> today's weather </a> </li>
<Li> <a href = "#"> forecast </a> </li>
</Ul>
</Li>
<Li> <a href = "#"> contact me </a> </li>
</Ul>
</Div>
</Body>
</Html>

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.