14/14 why is the .accordion opening the 1st section by default


#1

14/14 why is the .accordion opening the 1st section by default

the code is correct but the 1st section show open.

here is the code

$(document).ready(function(){
$('#menu').accordion();
});

any ideas


#2

From the http://api.jqueryui.com/accordion/ docs:

active

Type: Boolean or Integer
Default: 0
Which panel is currently open.
Multiple types supported:
Boolean: Setting active to false will collapse all panels. This requires the collapsible option to be true.
Integer: The zero-based index of the panel that is active (open). A negative value selects panels going backward from the last panel.
Code examples:
Initialize the accordion with the active option specified:

1
2
3
$( ".selector" ).accordion({
active: 2
});

So setting active: false maybe would work for you.


#3

Per the docs above,

$(document).ready(function(){
    $('#menu').accordion({
        collapsible: true,
        active: false
    });
});

#4

IS not working for me:D


#5

I would like to do this menu, but when I rewrote this code I don't have this animate effect. What should I do on CSS and JQ? Maybe some tutorials on this menu (according)? It would be nice...


#6

Be sure your page is loading jQuery UI, and one of the theme CSS files (smoothing is the old default).

The load sequence should be as follows:

  1. load theme css
  2. load styles.css
  3. load jQuery core
  4. load jQuery UI
  5. load script.js