Jquery implements the menu function (click to expand or close)-generally applied to the background, jquery applied

Source: Internet
Author: User

Jquery implements the menu function (click to expand or close)-generally applied to the background, jquery applied

<! Doctype html> 

:


A left-side menu in the background is used to create code, and Jquery is used for folding and expansion. In actual work, JQUEY is usually used?

I can tell you the idea. If there are three menus, we will use three divs and the outermost layer will set a large div to fix them. Clicking to expand will actually change the height of one or two divs, the premise is that the positioning method is well done. Do not absolute positioning. It is difficult to control. Use jquery to respond to click events and use the jquery animate function to create an animation. My computer has just been reinstalled and dreamweaver cannot be installed for you. jquery is very quick to get started.

Question about menu clicking time implemented by jquery

// When processing click expansion, you can close all the previously opened menus.
$ (Document). ready (function (){
$ ("Li. mainlevel"). click (function (){
$ ("Li. mainlevel> ul"). hide ();
$ (This). find ("ul"). slideDown (300 );
});
});

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.