Implementation of three-level Pull-down menu _jquery based on jquery

Source: Internet
Author: User

This example for you to share the jquery three level drop-down menu of the specific implementation code for your reference, the specific content as follows

In writing this, first of all, to smooth out the idea. Click on a menu, the other to close, point level menu, the level two or three menu to close, and so on.
The approximate code is as follows:

<body> <aside> <ul class= "One" > <li> <a href= "#" class= "a" > directory a</a> <ul C  Lass= "Two" style= "Display:none" > <li><a href= "#" class= "a" > Level two directory a</a> <ul "class=" style= "Display:none" > <li><a href= "#" > Level three directory a</a></li> </ul> </li&gt
     ; <li><a href= "#" class= "a" > Level two directory b</a></li> <li><a href= "#" class= "a" > Level two directory c</a& gt;</li> </ul> </li> <li> <a href= "#" class= "a" > directory b</a> <ul class= "tw O "style=" Display:none "> <li><a href=" # "class=" a "> Level two directory a</a> <ul class=" three "style=" Display:none "> <li><a href=" # "> Level three directory a</a></li> </ul> </li> & Lt;li><a href= "#" class= "a" > Level two directory b</a></li> <li><a href= "#" class= "a" > Level two directory c</a& Gt;</li>;/ul> </li> <li> <a href= "#" class= "a" > directory c</a> </li> </ul> </aside>
   jquery section <script src= "Js/jquery-1.8.3.min.js" ></script> <script> $ (document). Ready (function () { $ ('. a '). Click (function () {if ($ (this). Siblings (' ul '). CSS (' display ') = = ' None ') {$ (this). Siblings (' ul '). Slidedo
     Wn. Children (' Li '); if ($ (this). Parents (' Li '). Siblings (' Li '). Children (' ul '). CSS (' display ') = = "Block") {$ (this). Parents (' Li '). Siblings

     (' Li '). Children (' ul '). Slideup (100);
     } else {//control itself menu hidden $ (this). Siblings (' ul '). Slideup (100);
    Control the menu to hide $ (this). Siblings (' UL '). Children (' Li '). Children (' ul '). Slideup (100);
 }
   });
});

 </script> </body>

If you want to add a style, be sure to note that otherwise the menu may appear to be wrong.
Full code address: Https://github.com/SabrinaTian/ThreeMenuNav.git
git also has a case with an icon, no click is the + number, the menu opened, changed to-number.
The above is the entire content of this article, I hope to help you learn.

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.