Jquery vertical multilevel accordion menu with source code download _ jquery

Source: Internet
Author: User
This article will share with you a simple but practical multi-level vertical accordion drop-down menu list that uses css to create a multi-level accordion menu, this code is used to group different sub-menus to produce multi-level menu effects. This article is accompanied by a result demonstration and a friend interested in source code download to learn it first, continue to look at your favorite friends.

This is a simple but practical multi-level vertical accordion drop-down list menu. The multi-level accordion menu is completely made using CSS. It groups different sub-menus to produce the multi-level menu effect.

The multilevel accordion menu is created by using the checked pseudo element on the checkbox element. If you need some nice animation effects, you can use the main. js file provided by the plug-in. It can provide the animation effects of the Small arrow on the left when the menu is opened or shrunk.

Download demo source code

Usage

HTML Structure

The HTML structure of the multilevel accordion menu is very simple: the entire accordion is an unordered list. If a list item contains a sub-menu, add an input [type = checkbox] and a label, and add a. has-children class for this list item. All other standard list items are included in a tag.

 
 
  • Group 1
    • Sub Group 1
      • Image
      • Image
      • Image
    • Image
    • Image
  • Image
  • Image

CSS style

The multilevel accordion menu only uses CSS to detect click and expand sub-menus. It uses the checkbox element and then the checked pseudo class and the adjacent sibling selector to change

    The display mode of the element, from "none" to "block ".

    First, make sure that all list items with sub-menus contain the checkbox element. When you click a label element, you actually click the corresponding checkbox element, which is implemented by setting the for Attribute of the label element. Then we can simply hide the checkbox element and replace it with the label element.

    .cd-accordion-menu input[type=checkbox] { /* hide native checkbox */ position: absolute; opacity: 0;}.cd-accordion-menu label, .cd-accordion-menu a { position: relative; display: block; padding: 18px 18px 18px 64px; background: #4d5158; box-shadow: inset 0 -1px #555960; color: #ffffff; font-size: 1.6rem;}  

    JavaScript

    If you need to add some nice animated effects to this accordion menu, you can use the main. js file provided in jQuery and the plug-in. At the same time, you need to add the. animate class to the ul. cd-accordion-menu element, which will make the direction of the Small Arrow animated when opening and closing the sub-menu.

    The above content is the full description of Jquery vertical multi-level accordion menu with source code download introduced in this article. I hope you will like it. You can click to download the source code.

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.