Shorthand

You may have noticed that no parameters are passed to %TWISTY{}% but the show and hide links do have text! The default values are fetched from plugin settings TWISTYSHOWLINK and TWISTYHIDELINK, see Plugin Settings below.

Attention: The default mode works for content that is a single paragraph. Use the div mode in all other cases:

Make it obey only the first time

To let the Twisty start with its content folded open the first time the visitor sees the Twisty, add the parameter firststart="show". If remember="on" is used, subsequential visits to the page will display the Twisty according the cookie setting.

Other use: Hide interface if no JavaScript

You can use Twisty to show interface elements that should only be visible with JavaScript enabled. For instance the textbox control buttons in the edit screen need JavaScript to work. If a visitor does not have JavaScript on it would not make sense to show these buttons.

Put the "JavaScript content" in an almost bare bones Twisty. Write showlink="" hidelink="" to not display any default link texts.

Special syntax: format tokens

If you use TWiki variables inside TWISTY parameters chances are it will mess up the variable, or the rendered html. Use format tokens to 'delay' rendering of these variables until the Twisty parameters are parsed.

Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.

optional, defaults to <span>

showimgleft

Image url

Specify the url of an image that will be displayed with the show link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

hideimgleft

Image url

Specify the url of an image that will be displayed with the hide link at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

showimgright

Image url

Specify the url of an image that will be displayed with the show link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

hideimgright

Image url

Specify the url of an image that will be displayed with the hide link at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

remember

"on", "off"

If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared.Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.

optional, no default

start

"hide" or "show"

Initial state of the Twisty; this will override any setting stored in a cookie (see remember).

optional, default no initial state

firststart

"hide" or "show"

Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).

Specify if the Twisty Show link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.

optional, defaults to <span>

img

Image url

Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

imgleft

Image url

Specify the url of an image that will be displayed at the left side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

imgright

Image url

Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

remember

"on", "off"

If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared.Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.

optional, no default

start

"hide" or "show"

Initial state of the Twisty; this will override any setting stored in a cookie (see remember).

optional, default no initial state

firststart

"hide" or "show"

Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).

Specify the url of an image that will be displayed at the right side of the link. You may use ICONURLPATH to display one of the TWikiDocGraphics icons. Alternatively use an image attached to the topic.

optional, defaults to no image

link

Link label

Hide link label

optional

mode

"div" or "span"

Specify if the Twisty Hide link will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.

optional, defaults to <span>

remember

"on", "off"

If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared.Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.

optional, no default

start

"hide" or "show"

Initial state of the Twisty; this will override any setting stored in a cookie (see remember).

Specify if the Twisty Toggle section will use a <div> or a <span> tag. Note that if the contents contains block elements such as div, mode should be div as well to create valid HTML markup.

optional, defaults to <span>

class

CSS class name

Class for content div or span

optional, default none

remember

"on", "off"

If "on", the Twisty state is remembered the next time the page is shown. If "off", the stored setting will be cleared.Note: when used, think carefully about a unique name (id) for the Twisty, otherwise the cookie that is set might affect other Twisties with the same name. Also note that only interaction is stored, not the state of the Twisty when left unclicked.

optional, no default

start

"hide" or "show"

Initial state of the Twisty; this will override any setting stored in a cookie (see remember).

optional, default no initial state

firststart

"hide" or "show"

Initial state of the Twisty the first time the visitor gets to see the Twisty; this will NOT override cookie settings (see remember).

Plugin Settings

Plugin settings are stored as preferences settings. Do not change the settings here, they are here only for illustration purposes showing the default values. Define the settings in Main.TWikiPreferences. For example, to customize the TWISTYREMEMBER setting, add a * Set TWISTYPLUGIN_TWISTYREMEMBER = ... bullet in Main.TWikiPreferences.

Set TWISTYSHOWLINK = More...

For example: More...

Set TWISTYHIDELINK = Close

For example: Close

Set TWISTYMODE =

Either div or span; span if nothing set

Set TWISTYREMEMBER =

Either on or off; default is not specified. If set to on all Twisty states will be stored in a TWIKIPREF cookie; if set to off the TWIKIPREF cookie will be cleared

1.4 Arthur Clemens - Updated to work without ugly inserted javascript 'init' calls. This will change nothing to the functionality, but it will produce cleaner HTML, while at the same time the twisty is still set immediately (not at page onload) and graceful fallback in case of no javascript is maintained.

19 Jun 2006

1.3 Arthur Clemens - Updated with TWiki 4 JavaScript files.

25 Oct 2006

1.2 New variables to set default values: TWISTYSHOWLINK, TWISTYHIDELINK, TWISTYMODE, TWISTYREMEMBER; property id is no longer required as this is automatically set (still recommended in some cases with remember="on"); property value remember="off" will clear a previously stored cookie; new properties prefix and suffix; JavaScript to collapse or expand all Twisties on the page.

27 Sep 2006

1.101 Fixes JavaScript handling when AllowInlineScript in configure is not set