Jquery accordion crashed by default on page load

I am using the jQuery UI accordion on my page. I have Javascript code on my page load:

$(function() {
    $("#accordion").accordion({
            active: false,
            autoHeight: false,
            navigation: true,
            collapsible: true
        });

});

When the page loads, all tabs are open for several seconds and then reset. Maybe its loading effect. How to make jQuery UI Accordion crash on page load. Please suggest

+5
source share
6 answers

Although this is not a direct answer, perhaps you can make it hidden and then show it when you create it:

$("#accordion").accordion({
   active: false,            
   autoHeight: false,            
   navigation: true,            
   collapsible: true,
   create: function(event, ui) { $("#accordion").show(); }
});

Update: This fiddle works for me: http://jsfiddle.net/47aSC/6/

+11
source

For me, this works:

$(function() {
    $( "#accordion" ).accordion({
            collapsible: true,
            autoHeight: true,
            active: false

        });
});
+8

, - . , display:none, css, :

$("#accordion").show().accordion({
        active: false,
        autoHeight: false,
        navigation: true,
        collapsible: true
    });

( @Mrchief), , .accordion() . .

+3

:

jquery.ui.accordion.js 29 31 (, 1.10.4).

29 Active: 100, 31 : true,

- script . (, 100), , 100- h3- ( ).

: true , h3 .

.

+1
$(document).ready(function() {
   $('.collapse').collapse({
     toggle: false
   });
});

.collapse DOM, DOM.

+1

// , , bootstrap 2.0

    $(document).ready(function () {
          if ($("#accordianId").length>0) {
                        $("#accordianId").trigger("click");
                    }
             });

bootstrap 3.0

$( "#accordianId" ).accordion( "option", "active", 0 );
0

All Articles