1, first go to the jQuery official website to download js library, URL for http://jquery.com/
2. Create a jQuery sample project.
3. Place the js library in the jQuery sample project.
4. Write an html page
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Meta http-equiv = "author" content = "Kong. Yee"/>
<Meta http-equiv = "corporation" content = "Guangzhou Kuang Xing Software Technology Co., Ltd."/>
<Meta http-equiv = "contact" content = "791663094 or kong.yee@foxmail.com"/>
<Script type = "text/javascript" language = "JavaScript" src = "js/jquery-1.10.2.js"> </script>
<Title> Insert title here </title>
<Style type = "text/css">
. Bg {
/* Background Color */
Background: # f00;
/* Font color */
Color: # fff;
Width: 80px;
}
Ul, li {
/* Clear the default dot on ul and li */
List-style: none;
}
Ul {
/* Clear the indent value of the sub-menu */
Padding: 0;/* IE8, IE9, Firefox can; IE7, IE6, IE5.5 cannot */
Margin: 0;/* all available */
}
</Style>
<Script type = "text/javascript">
$ (Function (){
// SetColor is the method for moving the mouse
$ ("Li"). mouseover (setColor). mouseout (setColor );
Function setColor (){
// Delete (ADD) a class if it exists (does not exist)
$ (This). toggleClass ("bg ");
}
});
</Script>
</Head>
<Body>
<Div id = "div">
<Ul>
<Li> horizontal menu 1 </li>
<Li> horizontal menu 2 </li>
<Li> landscape menu 3 </li>
<Li> horizontal menu 4 </li>
<Li> horizontal menu 5 </li>
<Li> lateral menu 6 </li>
</Ul>
</Div>
</Body>
</Html>
5. Run
Remarks
* Technical Exchange and Cooperation: QQ: 791663094; Email: kong.yee@foxmail.com