Web Development with jQuery®

(Elliott) #1

Changing the Default Pane (^) ❘ 377
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Vestibulum luctus rutrum orci. Praesent faucibus tellus
faucibus quam. Aliquam erat volutpat. Nam posuere.







The following style sheet is applied to the preceding markup document:
body {
font: 12px "Lucida Grande", Arial, sans-serif;
background: #fff;
color: rgb(50, 50, 50);
margin: 0 ;
padding: 0 ;
}
h4 {
margin: 5px;
}
ul {
list-style: none;
margin: 0 ;
padding: 15px 5px;
}
li {
background: gold;
padding: 3px;
width: 244px;
margin: 1px;
}
In the following script, you see that the integer 1 is provided to the active option, which causes the
second
  • element in the markup document to be used as the default content pane:
    $(document).ready(
    function()
    {
    $('ul').accordion({
    active : 1
    });
    }
    );
    Figure 15-2 shows that the content under Paul McCartney is now the default content. The active
    option selects the default content when you provide it a zero offset integer (where zero is the fi rst
    item, one is the second item, and so on) that represents the item in the collection that you want to
    select by default. In this case, Paul McCartney is the second item, so 1 is provided as the value to the
    active option to select that panel.
    [http://www.it-ebooks.info](http://www.it-ebooks.info)
  • Free download pdf