A jquery-based animation navigation menu that responds to click events. The jquery navigation menu

Source: Internet
Author: User

A jquery-based animation navigation menu that responds to click events. The jquery navigation menu

Today, I will share with you a jquery-based animation navigation menu. This navigation menu, a button in the middle of the page, click the button, the menu from the left navigation page. Click the button again to navigate to the left-side message. The animation effect is very dazzling. Let's take a look:

Source code download

Html code:

<ul><li><a href="http://www.w2bc.com">First</a></li><li><a href="http://www.w2bc.com">Second</a></li><li><a href="http://www.w2bc.com">Third</a></li><li><a href="http://www.w2bc.com">Fourth</a></li><li><a href="http://www.w2bc.com">Fifth</a></li></ul><button>Animate</button><script src='jquery.js'></script><script> $('button').on('click', function () {$('ul').toggleClass('animate');}); //@ sourceURL=pen.js</script>

Css code:

body{text-align: center;}ul{width: 400px;padding: 0;margin: 0 auto;}ul.animate li{transform: translate(0);}ul.animate li:nth-of-type(1){transition-delay: 0.05s;}ul.animate li:nth-of-type(2){transition-delay: 0.1s;}ul.animate li:nth-of-type(3){transition-delay: 0.15s;}ul.animate li:nth-of-type(4){transition-delay: 0.2s;}ul.animate li:nth-of-type(5){transition-delay: 0.25s;}li{list-style: none;display: block;padding: 20px;margin: 12px 0;border-radius: 5px;font-family: Helvetica, sans-serif;color: #fff;background: #8DE48D;transform: translate(-500%);transition: transform 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.08);}li:nth-of-type(5){transition-delay: 0.15s;}li:nth-of-type(4){transition-delay: 0.3s;}li:nth-of-type(3){transition-delay: 0.45s;}li:nth-of-type(2){transition-delay: 0.6s;}li:nth-of-type(1){transition-delay: 0.75s;}button{padding: 12px 18px;border: none;border-radius: 3px;color: #fff;background: #7DBED8;}button:focus{outline: none;}

When I click in the navigation bar made by jquery, all the level-2 menus are displayed. How can I show only one menu?

I suggest you add a name for each option on the list to be clicked. The name is the same as the actual list class name.
<Li name = "tr"> Home </li>
<Li name = "tr1"> homepage 2 </li>
<Li name = "tr2"> homepage 3 </li>
<Li name = "tr3"> homepage 4 </li>
<Li name = "tr4"> Home Page 5 </li>
<Li name = "tr5"> homepage 6 </li>
<Li name = "tr6"> homepage 7 </li>
<Li name = "tr7"> homepage 8 </li>

Then jquery
$ (Document). ready (function (){

$ ('# Td li'). click (function (){
$ ("# Men." + $ (this). attr ("name" )).css ("display", "inline ");
});
});

Click the effect in the jquery navigation menu.

In fact, this should be combined with the background language (such as php and asp). When the id value sent from the url is the same as the id value of the current navigation connection, it will change the background.

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.