DHTMLX Docs & Samples Explorer

Object Constructor

Constructor is used to create an object, to set its initial parameters.

Syntax:

var accord = new dhtmlXAccordion(parent, skin);

where

  • parent - the id of an HTML element which will be used as a parent (or an object itself);
  • skin - the name of a skin, optional (string);
<div id='my_accord_here' style="width:500px; height:150px;"></div>
<script>
  //common init code
  var dhxAcc = new dhtmlXAccordion("my_accord_here");
</script>

Layout, Window, Accordion, Tabbar can create accordion inside their cells by using

some_component.cells(some_id).attachAccordion()

Starting from 2.5 version fullscreen initialization is available in the accordion.

First, you should define the following style:

html, body {
     width: 100%;
     height: 100%;
     margin: 0px;
     overflow: hidden;
}

and then init dhtmlxAccordion:

var dhxAcc = new dhtmlXAccordion(document.body);

Starting from 2.5 version, accordion can be initialized by object notation

var dhxAcc = new dhtmlXAccordion({
      some_option1:some_value_1,
      some_option2:some_value_2,
      ...
      some_optionN:some_value_N,
})

List of supported options

var dhxAcc = new dhtmlXAccordion({
	parent:"my_accord_here",
	onActive:function(){
	alert("I'm active");	
	}
});