Use JQuery & CSS3 to achieve an elegant accordion effect

Source: Internet
Author: User
Tags html sample

Accordion effects are often used to toggle the display of a set of content, which can save both Web space and animation. Today, we will create an elegant accordion content effect. The idea is that there are some vertical accordion tabs that slide out when hovering. We will add some CSS3 properties to enhance the appearance.

Effects Demo Plugin Download

HTML Sample code:

<ul class= "accordion" id= "accordion" >    <li class= "bg1" >        <div class= "heading" >heading</ div>        <div class= "bgdescription" ></div>        <div class= "description" >            

CSS Sample code:

Ul.accordion li description h2{    text-transform:uppercase;    Font-style:normal;    Font-weight:bold;    letter-spacing:1px;    font-size:45px;    Color: #444;    Text-align:left;    margin:0px 0px 15px 20px;    text-shadow:-1px-1px 1px #ccc;} Ul.accordion li description p{    line-height:14px;    margin:10px 22px;    font-family: "Trebuchet MS", Sans-serif;    font-size:12px;    Font-style:italic;    Font-weight:normal;    Text-transform:none;    Letter-spacing:normal;    Line-height:1.6em;} Ul.accordion li description a{    position:absolute;    bottom:5px;    left:20px;    Text-transform:uppercase;    Font-style:normal;    font-size:11px;    Text-decoration:none;    Color: #888;} Ul.accordion li. Description a:hover{    color: #333;    Text-decoration:underline;}

JavaScript code:

$ (function () {    $ (' #accordion > Li '). Hover (        function () {            var $this = $ (this);            $this. Stop (). Animate ({' width ': ' 480px '},500);            $ ('. Heading ', $this). Stop (True,true). FadeOut ();            $ ('. Bgdescription ', $this). Stop (True,true). Slidedown (+);            $ ('. Description ', $this). Stop (True,true). FadeIn ()        ,        function () {            var $this = $ (this);            $this. Stop (). Animate ({' width ': ' 115px '},1000);            $ ('. Heading ', $this). Stop (True,true). FadeIn ();            $ ('. Description ', $this). Stop (True,true). FadeOut (+);            $ ('. Bgdescription ', $this). Stop (True,true). Slideup ();}        )    ;

  

Related articles that may be of interest to you
    • Web development in a very practical 10 effects "source Download"
    • Carefully selected excellent jquery Ajax page plug-ins and tutorials
    • 12 Amazing ideas for 404 error page Design
    • Let the website Move! 12 Excellent jQuery animation plugins
    • Stunning 8 x HTML5 & JavaScript Effects

This article links: using JQuery and CSS3 to achieve an elegant accordion effect

Compilation Source: Dream Sky focus on front-end development technology sharing web design resources

Use JQuery & CSS3 to achieve an elegant accordion effect

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.