Template:Collapsible
This template displays a link that can be used to make collapsible information using a script we stole from ED.
It degrades cleanly with JS disabled.
Parameters
- text - The text of the link displayed when Javascript is turned off. Leave empty if you don't want to display anything with JS off.
- expand - The text of the "expand" link displayed when Javascript is turned on and the content is collapsed. If you filled in text, you can leave it empty, and text will be used preceded by a disclosure triangle (see examples)
- collapse - The text of the "collapse" link displayed when Javascript is turned on and the content is displayed. If you filled in text, you can leave it empty, and text will be used preceded by a disclosure triangle (see examples)
- initialstate - default visibility of the content. 1 = visible - 0 = hidden. Default: 0
- id - The id of the element to hide. Required.
Examples
Example 1
{{collapsible |text=SPOILER |id=spoiler |initialstate=1 }} <strong id="spoiler">YOU DIES</strong>
SPOILER
YOU DIES
Example 2
{{collapsible |collapse=[hide] |expand=[show] |id=andiwanttodie }} <div id="ihatemyself">I hate myself</div> <div id="andiwanttodie">And I want to die</div>
I hate myself
And I want to die
Note: With javascript turned off, both lines are visible by default, and no [show]/[hide] link is shown.
Hints
- See how it's used in Template:DQN Art
- Remember that an id can only be used once in a page
- The content to hide and the collapse link can be on different parts of the page.