jquery makes simple Web navigation effects

Source: Internet
Author: User

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

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.