Dynamic Jquery Accordion

Posted by kwek-kwek on Stack Overflow See other posts from Stack Overflow or by kwek-kwek
Published on 2010-03-31T20:21:48Z Indexed on 2010/04/01 13:13 UTC
Read the original article Hit count: 359

How do I default an accordion to be closed on start-up. here is the sample view here

Here is the code:

<script>
$(function() { 

$("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'});
});
</script>

<script>

// add new effect to the tabs
$.tools.tabs.addEffect("slide", function(i, done) {

    // 1. upon hiding, the active pane has a ruby background color
    this.getPanes().slideUp("slow").css({backgroundColor: "#fff"});

    // 2. after a pane is revealed, its background is set to its original color (transparent)
    this.getPanes().eq(i).slideDown("slow", function()  {
        $(this).css({backgroundColor: 'transparent'});

        // the supplied callback must be called after the effect has finished its job
        done.call();
    });
});
</script>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-plugins