How to adapt script
- Create class for each panel (define colors etc)
- Create new panel with UNIQUE id
-
Add links to open/close each panel indicating the id of the panel to move:
<a href="#" onclick="initSlideLeftPanel('dhtmlgoodies_leftPanel3');return false"> Show panel 3</a> - Look for the "initSlideLeftPanel()" function and replace the first few lines:
with the following code which now uses the specific id of the panel to be closed:function initSlideLeftPanel(expandOnly) { if(slideInProgress)return; if(!slideLeftPanelObj){ if(document.getElementById('dhtmlgoodies_leftPanel')){ // Object exists in HTML code? slideLeftPanelObj = document.getElementById('dhtmlgoodies_leftPanel'); if(panelPosition == 1)slideLeftPanelObj.style.width = '100%'; }else{ // Object doesn't exist -> Create <div> dynamically slideLeftPanelObj = document.createElement('DIV'); slideLeftPanelObj.id = 'dhtmlgoodies_leftPanel'; slideLeftPanelObj.style.display='none'; document.body.appendChild(slideLeftPanelObj); } //etc.
Note that I have also added an increaseing z-index for each panel to ensure that it slides out above the previous panel.var z_index=10; function initSlideLeftPanel(the_panel,expandOnly) { // reset "slideLeftPanelObj" if different from last one for closing panes if(the_panel!=slideLeftPanelObj.id)slideLeftPanelObj=""; if(slideInProgress)return; if(!slideLeftPanelObj){ z_index++; if(document.getElementById(the_panel)){ // Object exists in HTML code? slideLeftPanelObj = document.getElementById(the_panel); slideLeftPanelObj.style.zIndex = z_index; if(panelPosition == 1)slideLeftPanelObj.style.width = '100%'; }else{ // Object doesn't exist -> Create <div> dynamically slideLeftPanelObj = document.createElement('DIV'); slideLeftPanelObj.id = the_panel; slideLeftPanelObj.style.display='none'; //slideLeftPanelObj.style.z-index='none'; document.body.appendChild(slideLeftPanelObj); } //etc. - To have a specific panel slide out on load like in this example, modify the <body> tag with this:
<body onload="initSlideLeftPanel('NAME OF PANEL TO SLIDE OUT');return false;">
