Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jason on Feb 09, 2009 10:58
open dhtmlx forum
Accordion Size

Is there a way to get the accordion to autosize to the size of the contents inside each section. So when I switch sections I want it to resize so that there doesn't have to be a scroll bar inside the accordion.
Answer posted by Alex (support) on Feb 10, 2009 02:35

There is no such a built-in feature. 

Possibly the following approach will be suitable for you:

You can try to set onActive event handler and change the height of the outher container accoding to the selected item id:

var dhxAccord = new dhtmlXAccordion("accordObj");

dhxAccord.attachEvent("onActive", function(itemId){

 if(itemId=="a1"){

  document.getElementById("accordObj").style.height = "600px";
 }
 else document.getElementById("accordObj").style.height = "400px";

 dhxAccord.setSizes();
});