FANDOM


Toggler allows to use simple set of rules to create toggleable elements on a page.

Usage

Toggler will work on elements having _toggler class. Add _toggle class to elements to toggle. You can use _toggle_inithide and _toggle_initshow classes to set initial state.

Example

Toggleable spans:
* <span class="_toggler _toggle _toggle_inithide">span1</span><span class="_toggler _toggle">span2</span>
* <span class="_toggler _toggle _toggle_inithide">span3</span><span class="_toggler _toggle">span4</span>

Toggleable spans:

  • span1span2
  • span3span4

Installation

Importing multiple scripts? This quick guide shows how to combine the imports.
  • For site-wide use, an administrator can add the line below to the wiki's MediaWiki:ImportJS page.
dev:Toggler.js
  • For personal use, add the code snippet below to your global.js page (for use on all wikis) or your common.js page on your wiki (for use on a single wiki). Note that personal JS must be enabled for your account.
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:Toggler.js',
    ]
});