Template:Toggle
Template Documentation (sometimes hidden or invisible)
Template tools: purge • what links here • what transclude this • subpages |
- Description
This template has to be use in parallel with toggling functions. It will only create the element that will be hidden/shown by the function.
- Dependencies
This template uses the following JavaScript codes: MediaWiki:Common.js/elementClass.js and MediaWiki:Common.js/togglers.js. The codes must be placed or imported in MediaWiki:Common.js.
- Syntax
{{Toggle|default=<>|sost=<>|var=<>}}. Or if given as free parameters: {{Toggle|<Valore di default>|<Valore da sostituire>|<Nome variabile>}}.
The switch element must have this class (you can use a tag like this): <span class="_toggler-toto">Change</span>
.
- Parameters
1=/default= default text - optional.
2=/sost= alternative text - optional.
3=/var= element ID - avoid giving the same ID two different not-related switch elements.
- Samples
Change a text with another through a link: {{Toggle|default=<Default>|sost=<Alternative>|var=<switch1>}} and
<span class="_toggler-switch1">Change!</span>
give:
Default
Change!
If the second parameter is null, then the text will be hidden:
{{Toggle|default=<This text will be hidden>}} and
<span class="_toggler-switch2">Hide</span>
give:
This text will be hidden
Hide
To change the contents with different links:
{{Toggle|<text 1 (as first parameter is the default text)>|<>|<var1>}}
{{Toggle|<>|<text 2 (as second parameter is hidden by default)>|<var2>}}
<span class="_toggler_hide-var2 _toggler_show-var1">link var1</span> <span class="_toggler_hide-var1 _toggler_show-var2">link var2</span>
text 1
link var1 |
link var2
- Other
The "toggling classes" used by this template are:
- "_toggle NAMEVAR
": element NAMEVAR
, the ID.
- "_toggler_hide-NAMEVAR
": clicking on this element, NAMEVAR
will be hidden.
- "_toggler_show-NAMEVAR
": clicking on this element, NAMEVAR
will be shown.
An element can have multiple classes.
- See also
- Help
For help with this template you can contact leviathan_89.
Visit Template:Toggle/doc to edit this text! (How does this work?) (Refresh this text)