Iliyan Peychev![]()
Featured Item| Accordion is a visual widget that allows the expansion/collapse of grouped items containing arbitrary data. These items can be:
|
![]() |
Create Accordion from script and add three items.
YUI({
modules: {
'gallery-accordion': {
fullpath: 'http://yui.yahooapis.com/gallery-2009.12.08-22/build/gallery-accordion/gallery-accordion-min.js',
requires: ['event','anim-easing','widget','widget-stdmod','json-parse'],
optional: ['dd-constrain','dd-proxy','dd-drop'],
supersedes: []
}
}
}).use('gallery-accordion', function(Y) {
var item1, item2, item3, accordion;
accordion = new Y.Accordion( {
contentBox: "#acc1",
useAnimation: true,
collapseOthersOnExpand: true
});
accordion.render();
item1 = new Y.AccordionItem( {
label: "Item1, added from script",
expanded: true,
contentBox: "dynamicContentBox1",
contentHeight: {
method: "fixed",
height: 80
},
closable: true
} );
item1.set( "bodyContent", "This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"fixed, 80px\"." );
accordion.addItem( item1 );
item2 = new Y.AccordionItem( {
label: "Item2, added from script",
expanded: true,
contentBox: "dynamicContentBox2",
contentHeight: {
method: "stretch"
}
} );
item2.set( "bodyContent", "This is the body of the item, added dynamically to accordion, before item1.<br>Content height has been set as \"stretch\"." );
accordion.addItem( item2, item1 );
item3 = new Y.AccordionItem( {
label: "Item3, added from script",
expanded: true,
alwaysVisible: true,
contentBox: "dynamicContentBox3",
contentHeight: {
method: "auto"
}
} );
item3.set( "bodyContent", "<div style='position:relative;'>This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"auto\".</div>" );
accordion.addItem( item3 );
});| Subject | Author | Date |
|---|---|---|
| w3c validation fails | Jeff Flesher | 11/3/09 |
| Re: w3c validation fails | Iliyan Peychev | 11/4/09 |
| Re: w3c validation fails | Iliyan Peychev | 11/10/09 |
| Scrollable | KReiss | 12/15/09 |
| Re: Scrollable | Iliyan Peychev | 12/16/09 |
| Re: Scrollable | KReiss | 12/16/09 |
| Re: Scrollable | Iliyan Peychev | 12/16/09 |
| Forcing an item to expand | alexlebek | 01/14/10 |
| Re: Forcing an item to expand | Iliyan Peychev | 01/14/10 |
| Re: Forcing an item to expand | alexlebek | 01/15/10 |
© 2010 YUI Library - Site Credits