Jquery _ jquery

Source: Internet
Author: User
This article mainly introduces jquery's method for implementing simple accordion menu effects. It analyzes the jQuery operation page style, html page layout, and SCSS style settings related skills, for more information about jquery, see the following example. Share it with you for your reference. The specific implementation method is as follows:

(function($) { var allPanels = $('.accordion > dd').hide(); $('.accordion > dt > a').click(function() {  allPanels.slideUp();  $(this).parent().next().slideDown();  return false; });})(jQuery);

HTML code:

 
 
Panel 1
Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.
Panel 2
Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.
Panel 3
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.

SCSS section:

/* Sorry if you don't use SASS. Should be pretty easy to convert. */.accordion {  margin: 50px;   dt, dd {   padding: 10px;   border: 1px solid black;   border-bottom: 0;   &:last-of-type {    border-bottom: 1px solid black;   }   a {    display: block;    color: black;    font-weight: bold;   }  } dd {   border-top: 0;   font-size: 12px;   &:last-of-type {    border-top: 1px solid white;    position: relative;    top: -1px;   } }}

I hope this article will help you with jQuery programming.

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.