The collapsible component is simple and flexible that allows you to easily add collapsible panels to your web page.
Supported browsers: Microsoft Internet Explorer 6+, Mozilla Firefox 3+, Apple Safari 3+, Google Chrome 1+
Page Time (24-hour): • Refresh This Page
You can pass options as key/value object to the component's function.
Key | Type | Default Value | Description |
---|---|---|---|
strPanelCss | string | panel_collapsible | The panel that surrounds the header and body markup structure. Requires a CSS class name. |
strCollapsibleHeaderCss | string | panel_collapsible_header | The header of the collapsible panel. Requires a CSS class name. |
strCollapsibleBodyCss | string | panel_collapsible_body | The body of the collapsible panel. Requires a CSS class name. |
strCookieNamespace | string | domain_ | The namespace is prepended to the generated cookie name. The cookie is used to save and restore collapsible state using the CSS id. |
strCollapsibleDirection | string | vertical | The direction of the collapsible panel(s) to open and close. |
fnLoad | function | null | Callback function after finishing setting up the collapsible panel(s). |
fnBeforeStart | function | null | Callback function before the panel open/close. |
fnAfterStop | function | null | Callback function after the panel open/close. |
1. Include required dependencies.
<script src="../js/jquery.js" type="text/javascript"></script>
<script src="../js/jquery.cookie.js" type="text/javascript"></script>
<script src="../js/diehard_collapsible.js" type="text/javascript"></script>
2. Add required markup structure using HTML.
<div id="region_panels">
<div class="panel">
<div class="panel_header">Test Header</div>
<div class="panel_body">Test Body</ediv>
</div>
</div>
3. Add required style using CSS.
#region_panels .panel .panel_header_left {float:left;width:13px;height:13px;margin:2px 8px 0 0;background:url(../components/collapsible/panel_collapse.jpg) transparent no-repeat 0 0;cursor:pointer;}
#region_panels .panel .collapsible_selected_hide .panel_header_left {background:url(../components/collapsible/panel_expand.jpg) transparent no-repeat 0 0;}
#region_panels .panel .panel_header {cursor:pointer;}
#region_panels .panel .panel_body {display:none;}
4. Add and run the code using JavaScript.
$('#region_panels').diehard_collapsible({
strPanelCss:'panel',
strCollapsibleHeaderCss:'panel_header',
strCollapsibleBodyCss:'panel_body',
strCookieNamespace:'appname_'
});
Created by William Chang