Collapse and expand wiki page content: Difference between revisions
| Line 3: | Line 3: | ||
=== MediaWiki default capabilities === | === MediaWiki default capabilities === | ||
For a block that starts collapsed: | For a block that starts collapsed: | ||
<syntaxhighlight lang="html><div class="mw-collapsible mw-collapsed"> | |||
<div class="mw-collapsible-content"> | |||
This content is hidden until the user clicks the line of text above. | |||
</div> | |||
</div></syntaxhighlight> | |||
<code>mw-collapsible</code> makes the element collapsible, while <code>mw-collapsed</code> makes it start collapsed. MediaWiki then supplies the Expand/Collapse control. MediaWiki | <code>mw-collapsible</code> makes the element collapsible, while <code>mw-collapsed</code> makes it start collapsed. MediaWiki then supplies the Expand/Collapse control. MediaWiki | ||
For something more useful, with a visible title: | For something more useful, with a visible title: | ||
< | <syntaxhighlight lang="html><div class="mw-collapsible mw-collapsed"> | ||
My additional information | My additional information | ||
<div class="mw-collapsible-content"> | |||
Here is all of the additional information that I don't | Here is all of the additional information that I don't | ||
want displayed until the reader expands it. | want displayed until the reader expands it. | ||
| Line 25: | Line 20: | ||
* Item two | * Item two | ||
* Item three | * Item three | ||
</div> | |||
</div></syntaxhighlight> | |||
You can also change the word [Expand] used for the text: | You can also change the word [Expand] used for the text: | ||
< | <syntaxhighlight lang="html><div class="mw-collapsible mw-collapsed" | ||
data-expandtext="Show more" | data-expandtext="Show more" | ||
data-collapsetext="Show less"> | data-collapsetext="Show less"> | ||
Additional information | Additional information | ||
<div class="mw-collapsible-content"> | |||
This is the hidden content. | This is the hidden content. | ||
</div> | |||
</div></syntaxhighlight> | |||
That functionality is built into MediaWiki's <code>jquery.makeCollapsible</code> module.</div> | That functionality is built into MediaWiki's <code>jquery.makeCollapsible</code> module.</div> | ||