The SpryCollapsiblePanel.css file provides the default styling for the Collapsible Panel widget. You can, however, easily customize the widget by changing the appropriate CSS rule. The CSS rules in the SpryCollapsiblePanel.css file use the same class names as the related elements in the collapsible panel’s HTML code, so it’s easy for you to know which CSS rules correspond to the different sections of the Collapsible Panel widget. Additionally, the SpryCollapsiblePanel.css file contains class names for widget behaviors (for example, hovering and clicking behaviors).
The SpryCollapsiblePanel.css file should already be included in your website before you start customizing. For more information, see Prepare your files.
**This sentence is a sample change for LiveDocs.**
Style a CollapsiblePanel widget (general instructions)Set properties for the entire Collapsible Panel widget container, or set properties for the components of the widget individually.
You can replace style-related class names in the SpryCollapsiblePanel.css file and HTML code with class names of your own. Doing so does not affect the functionality of the widget.
The SpryCollapsiblePanel.css file contains extensive comments, explaining the code and the purpose for certain rules. For further information, see the comments in the file.
Style Collapsible Panel widget textSet properties for the entire Collapsible Panel widget container, or set properties for the components of the widget individually.
To change the text format of a Collapsible Panel
widget, use the following table to locate the appropriate CSS rule,
and then add your own text styling properties and values.
|
Style to change |
Relevant CSS rule |
Example of properties and values to add or change |
|---|---|---|
|
Text in the entire collapsible panel |
.CollapsiblePanel |
font: Arial; font-size:medium; |
|
Text in panel tab only |
.CollapsiblePanelTab |
font: bold 0.7em sans-serif; (This is the default value.) |
|
Text in content panel only |
.CollapsiblePanelContent |
font: Arial; font-size:medium; |
Change Collapsible Panel widget background colors
Use the following table to locate the appropriate
CSS rule, and then add or change background color properties and
values.
|
Color to change |
Relevant CSS rule |
Example of property and value to add or change |
|---|---|---|
|
Background color of panel tab |
.CollapsiblePanelTab |
background-color: #DDD; (This is the default value.) |
|
Background color of content panel |
.CollapsiblePanelContent |
background-color: #DDD; |
|
Background color of tab when panel is open |
.CollapsiblePanelOpen .CollapsiblePanelTab |
background-color: #EEE; (This is the default value.) |
|
Background color of open panel tab when the mouse pointer moves over it |
.CollapsiblePanelTabHover, .CollapsiblePanelOpen .CollapsiblePanelTabHover |
background-color: #CCC; (This is the default value.) |
Constrain the width of a collapsible panelBy default, the Collapsible Panel widget expands to fill available space. To constrain the width of a Collapsible Panel widget, set a width property for the collapsible panel container.
Change collapsible panel heightTo set the height of a collapsible panel, add a height property to the CollapsiblePanelContent rule or the CollapsiblePanel rule.
In the SpryCollapsiblePanel.css file, add a height
property and value to the CollapsiblePanelContent rule,
for example, height: 300px;.
Change collapsible panel behaviorsThe collapsible panel widget includes a few predefined behaviors. These behaviors consist of changing CSS classes when a particular event occurs. For example, when a mouse pointer hovers over a collapsible panel tab, Spry applies the CollapsiblePanelTabHover class to the widget. (This behavior is similar to a:hover for links.) The behaviors are blank by default; to change them, add properties and values to the rules.
<script type="text/javascript">
var CP2 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel2", { hoverClass: "hover", openClass: "open", closedClass: "closed", focusedClass: "focused" });
</script>
Turn off panel animationBy default, a collapsible panel uses animation to smoothly open and close.
To turn off animation so that the panel instantly
opens and closes, send an argument in the collapsible panel constructor,
as follows:
<script type="text/javascript">
var CP5 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel5", { enableAnimation: false });
</script>
Set panel animation timingYou can change the time it takes for a panel to open. Set the time in milliseconds (1000 = 1 second). By default, Spry uses 500 milliseconds.
Add the duration option to the
constructor:
<script type="text/javascript">
var CP9 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel9", { duration: 100 });
</script>