Iliyan Peychev![]()
Featured Item| Accordion is a visual widget that allows the expansion/collapse of grouped items containing arbitrary data. These items can be:
|
![]() |
Build Accordion from script and add three items dynamically.
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.08.15-20-00'
}).use('gallery-accordion', function(Y) {
var item1, item2, item3, accordion;
accordion = new Y.Accordion({
srcNode: "#acc1",
useAnimation: true,
collapseOthersOnExpand: true
});
accordion.render();
item1 = new Y.AccordionItem( {
label: "Item1, added from script",
expanded: true,
id: "dynamicItem1",
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,
id: "dynamicItem2",
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,
id: "dynamicItem3",
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 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info