adds a new item to Accordion
id | string|number | item's id |
text | string | item's text |
open | boolean | optional, open cell on init |
height | number | optional, item's height (multi mode only) |
icon | string | optional, path to icon |
var myAcc = new dhtmlXAccordionObject(...);
// adding items
myAcc.addItem("item_a", "The Secret of Monkey Island", true, null, "icon.png");
myAcc.addItem("item_b", "Monkey Island 2: LeChuck's Revenge");
myAcc.addItem("item_c", "The Curse of Monkey Island");
If the parameter "open" isn't specified, the default behaviour is:
The parameter "height" in the multi mode can have the "*" value (means "auto"). In this case the logic will be the following:
For example, you have a multi mode accordion attached to a window with 3 autoheight cells. When all the cells are expanded, each cell has 1/3 of window's height. When one of them collapsed, each expanded cell will have 1/2 of window's height minus the height of the collapsed cell. If two cells collapsed - the expanded cell will occupy all the available space.
params: open, height and icon - added in 4.0
Back to top