Return to Snippet

Revision: 50367
at August 19, 2011 00:46 by stur


Initial Code
$("fieldset").each(function (){
                if($(this).attr('class')!='active'){
                    $("div.expandContent", this).hide();
                }
            });
            $(".expandChild").click(function (e){
                e.preventDefault();
                if(!$(this).hasClass('expandChildActive')){
                    $("div.expandContent").slideUp();
                    $(this).next().next().height($(this).next().next().height()); //Fix for slide jumping position
                    $(this).next().next().slideToggle();
                    $('button.expandChild').removeClass('expandChildActive');
                    $(this).addClass('expandChildActive');
                } else {
                    $(this).next().next().slideToggle();
                    $(this).removeClass('expandChildActive');
                }
            });

                <fieldset class="active">
                    <h1>Title</h1>
                    <button class="suspendacc"></button>
                    <button class="expandChild expandChildActive"></button>
                    <div class="clear"></div>
                    <div class="expandContent">

                    </div>
                </fieldset>
                <fieldset class="active">
                    <h1>Title 2</h1>
                    <button class="suspendacc"></button>
                    <button class="expandChild"></button>
                    <div class="clear"></div>
                    <div class="expandContent">

                    </div>
                </fieldset>

Initial URL

                                

Initial Description

                                

Initial Title
jQuery accordian without jQuery accordian

Initial Tags
jquery

Initial Language
jQuery