Personalized navigation menu written by JQuery _ jquery

Source: Internet
Author: User
Whether the visitor is interested in the website or not, the first impression of the first 20 seconds is crucial, so our design must meet the expectations of the public. Next we will design a personalized navigation menu. (1): XHTML:

The Code is as follows:




  • Home

  • Services

  • FAQ

  • Testimonials

  • About Alpacas

  • Contact Us




(2): JQuery

The Code is as follows:


$ (Document). ready (function (){
$ ('# NavigationMenu li. normalMenu'). each (function (){
// Create a duplicate hyperlink and position it abve the current one
$ (This). before ($ (this). clone (). removeClass (). addClass ('hopmenu '));
});
$ ('# NavigationMenu li'). hover (function (){
// We assign an action on mouse over
$ (This). find ('. hoverMenu'). stop (). animate ({marginTop: '0px '}, 200 );
// The animate method provides countless possibilities
},
Function (){
// And an action on mouse out
$ (This). find ('. hoverMenu'). stop (). animate ({marginTop: '-25px'}, 200 );
});
});


(3) CSS

The Code is as follows:


/* Page styles */
Body, h1, h2, h3, p, td, quote, small, form, input, ul, li, ol, label {
Margin: 0px;
Padding: 0px;
}
Body {
Margin-top: 20px;
Font-family: Arial, Helvetica, sans-serif;
Color: # 51555C;
Height: 100%;
Font-size: 12px;
}
/* Navigation menu styles */
Ul {
Height: 25px;
Font-family: Arial, Helvetica, sans-serif;
Font-size: 12px;
}
Ul li {
Border: 1px solid #444444;
Display: inline-block;
Float: left;
Height: 25px;
List-style-type: none;
Overflow: hidden;
}
Ul li a, ul li a: hover,
Ul li a: visited {
Text-decoration: none;
}
. NormalMenu,. normalMenu: visited,
. HoverMenu,. hoverMenu: visited,
. SelectedMenu,. selectedMenu: visited {
Outline: none;
Padding: 5px 10px;
Display: block;
}
. HoverMenu,. hoverMenu: visited,
. SelectedMenu,. selectedMenu: visited {
Margin-top:-25px;
Background: url (img/grey_bg.gif) repeat-x # eeeeee;
Color: #444444;
}
. SelectedMenu,. selectedMenu: visited {
Margin: 0;
}
. NormalMenu,. normalMenu: visited {
Color: white;
Background: url (img/dark_bg.gif) repeat-x #444444;
}


(4)
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.