Template:Spoilertogglesmall

From Ultima Codex
Jump to navigation Jump to search
SPOILER
Toggle

template places a spoiler toggle button and adds page to category:articles that reveal spoilers

Parameters[edit]

Spoilertogglesmall uses unnamed parameters:

{{Spoilertogglesmall
  |first parameter is a link id, is optional, the default value is "spoilertext"
  |second parameter is another link id, is optional
  |third parameter is another link id, is optional
  |fourth parameter is another link id, is optional
  |fifth parameter is another link id, is optional
}}

Note that link ids cannot have spaces. A button that points to no valid links will not be clickable.

Usage[edit]

Note this is an advanced feature, designed for someone familiar with HTML code. For a simplier way to toggle hidden text, see: template:spoilerbox

To create an element to be toggled, give it class="mw-collapsible mw-collapsed" and id="mw-customcollapsible-spoilertext". Replace the spoilertext with any text, but it must be unique per page and not contain spaces. The spoilertogglesmall must then be given that text as a linkId in order to control that element.

To start the element collapsed, also add mw-collapsed to the class.

Errors:

  • If you see the generic expand/collapse buttons then you did not link it properly.
  • If the button is not clickable (and the mouse cursor doesn't change to a pointer over it) then you didn't link it properly.

Example[edit]

{{spoilertogglesmall}}
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-spoilertext">You're reading the hidden text!</div>

Click the spoiler button at the top of the page to see this:

Note that the button can toggle multple ids, but each element on a page must have a unique id as per HTML specs.

{{spoilertogglesmall}}
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-spoilertext">First hidden text</div>

{{spoilertogglesmall|the hidden secret|spoilertext2}}
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-spoilertext2">Second hidden text</div>

You can also hide table rows:

{| class=wikitable
! Header !! Row
|-
| first || row
|- class="mw-collapsible mw-collapsed" id="mw-customcollapsible-secretrow"
| hidden || row
|-
| second || row
|}
{{spoilertogglesmall||secretrow}}

See Also[edit]