Use the hover () method in jquery to make it simple to change the background color according to the mouse movement;
Hover (); Used to simulate the mouse pointer hover event, when the mouse pointer moves to the element, the first specified function is triggered, and when the mouse pointer removes the element, the second function is triggered, and the specific code similar to the mouseover and mouseout combinations is as follows:
HTML code:
<DivClass= "NAV" ><Ul><li><Ahref= "#" > Home </a></Li><li><Ahref= "#" > Side navigation </a></Li><li><Ahref= "#" > Gourmet </a></Li><li><a href= "#" > Movie </< Span class= "End-tag" >a></LI> <li><a href= "#" >ktv</a></LI> <li><a href= "#" > Hotels </a></li> <li><a href= "#" > Shopping </a></LI> </ul> </DIV>
CSS:
. Nav{margin:0; padding:0px; width:800px; height:100px;} .nav ul{list-style:none;} a{text-decoration:none;} .nav ul li{width:100px; height:50px; line-height:50px; background-color: #999; display:inline; float:left; text-align:center; FONT-SIZE:18PX; font-weight:bold;
} /span>
< Span> JQ:
$ (function () {/* navigation background color switch effect hover ()*/$ ("li"). Hover (function () {$ (this). CSS ("Background-color", "#C60"); },function () {$ (this). CSS ("Background-color", "#999");});
});
< Span id= "line66" > < Span class= "Attribute-name" > < Span id= "line69" > &NBSP;
jquery makes simple Web navigation effects