Display and collapse the navigation menu effects and the accordion navigation menu

Source: Internet
Author: User

Display and collapse the navigation menu effects and the accordion navigation menu

Display and fold the navigation menu effect in the accordion mode:
This topic describes a code example that enables you to expand and collapse the navigation menu in the accordion mode.
The code example is as follows:

<! DOCTYPE html> 

The above code implements our requirements. The following describes the implementation process.
I. Code comments:
(1). $ (document). ready (function () {}). When the document structure is fully loaded, run the code in the function.
(2 ). $ ("dd: not (: first )"). in hide (), all dd elements except the first dd element are hidden, that is, the sub-menu of the first navigation menu is expanded and hidden.
(3). $ ("dt a"). click (function () {}) to register the click event processing function for element a under the dt element.
(4). $ ("dd: visible"). slideUp ("slow"), all the displayed dd elements are reduced and hidden by animation.
(5 ). $ (this ). parent (). next (). slideDown ("slow"): the parent element of the currently connected Element a, that is, the dt element. The next element of the dt element is the dd element of the level-2 menu. The menu is animated.
(6). return false, which is very important to prevent link Jump Actions.
Ii. Related reading:
(1).: not refer to the not selector section of jQuery.
(2).: For more information, see the first selector section of jQuery.
(3).: see the visible selector section in jQuery.
(4). slideUp () can refer to jQuery's slideUp () method.
(5). For details about parent (), see section 1 of parent () method of jQuery.
(6). next () can refer to jQuery's next () method.
(7). For details about return false, see what chapter does return false play in the link.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 18316.

For more information, see: http://www.softwhy.com/jquery/

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.