Collapse and expand wiki page content: Difference between revisions
| Line 39: | Line 39: | ||
=== MediaWiki Details extension === | === MediaWiki Details extension === | ||
The extension Details creates a full width text block that is always exposed | |||
< | * Users can click the text or the [Expand] link to display the hidden text. | ||
<summary> | * Formatting options | ||
** No formatting on text; cursor is not a pointer hovering on text, but is when hovering over [Expand] | |||
** Can only be configured in '''Edit source''' mode. | |||
<syntaxhighlight lang="html"><details class="wikicollapse"> | |||
<summary>This text is always visible; it can only be one line and must take up the full width.</summary> | |||
</details></ | This text is only viewable after the user clicks either the text or [Expand] above. It can include any type or amount of content. | ||
</details></syntaxhighlight> | |||
The result behaves like the familiar disclosure/accordion control on modern websites: click the summary and the content opens underneath it. | The result behaves like the familiar disclosure/accordion control on modern websites: click the summary and the content opens underneath it. | ||
You can also make it initially open: | You can also make it initially open: | ||
| Line 56: | Line 59: | ||
</details></code> | </details></code> | ||
<code>wfLoadExtension( 'Details' );</code> | <code>wfLoadExtension( 'Details' );</code> | ||
after putting the extension in the <code>extensions/Details</code> directory. MediaWiki | after putting the extension in the <code>extensions/Details</code> directory. MediaWiki | ||