Tuesday, December 11, 2012

code for expand all section in accordion



  function togglePanels(accordionId, headerSelector) {

    var accordion = $("#" + accordionId);
    var accordionHeader = $("#" + accordionId + ">" + headerSelector);
    var active = accordion.accordion("option", "active");

    if (active !== false) {
 
        accordionHeader.each(
            function(index) {
                if (index != active) $(this).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top").next()
            .addClass("ui-accordion-content-active").show();

                $(this).children(".spantxt")
                .removeClass("spanvis")
                .addClass("spanhide");
           
            }
        );
    } else {
        /*alert("Show all the panels!");*/
        accordionHeader.each(
            function() {
                $(this).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top").next()
            .addClass("ui-accordion-content-active").show();

                $(this).children(".spantxt")
                .removeClass("spanvis")
                .addClass("spanhide");
            }
        );
    }
}

Example :

  <script>
    function expandAll() {
        togglePanels("accordion", "h3");
    }
   
    </script>

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment