# %TOPIC% **A "twisty" is an interface toggle control to show and hide content.** TwistyPlugin gives you several options to control the appearance of a twisty: - use link text or buttons - position an icon left or right - remember the state at the next visit of the page - start the Twisty open or closed - start the Twisty open or closed for the first visit - use a span or div for the content - set a class for the content span or div Twisty has a fallback mechanism in case JavaScript is not available: all content is displayed and the control buttons are hidden.
Escape: | Expands To: |
---|---|
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". |
$quot |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
Parameter | Value | Description | Remark |
---|---|---|---|
id |
Unique identifier | Used to link [[Main/WebHome#VarTWISTYBUTTON]] and [[Main/WebHome#VarTWISTYTOGGLE]] | optional |
link |
Link label | Link label for both show and hide links | optional |
hidelink |
Link label | Hide link label | optional |
showlink |
Link label | Show link label | optional |
mode |
"div" or "span" |
Specify if the Twisty Toggle section will use a <div> or a <span> tag. |
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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 ). |
optional, default no initial state |
noscript |
"hide" |
Make content hidden in case use does not have JavaScript on | optional, default content is shown in case JavaScript if off |
class |
CSS class name | Class for Twisty div or span | optional, default none |
prefix |
Text | Text to display before the show/hide links | optional, default none |
suffix |
Text | Text to display after the show/hide links | optional, default none |
img |
Image url | %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% | optional, defaults to no image |
imgleft |
Image url | %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% | optional, defaults to no image |
imgright |
Image url | %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% | optional, defaults to no image |
hideimg |
Image url | %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% | optional, defaults to no image |
showimg |
Image url | %GREEN%Deprecated, use showimgleft, hideimgleft, showimgright or hideimgright.%ENDCOLOR% | optional, defaults to no image |
Ocassionally you might need to create a custom set of individual Twisty components:
noscript
and class
(only used for 'toggle' content) mode
: button mode defaults to span %TWISTYBUTTON{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
mode |
"div" or "span" |
Specify if the Twisty button will use a <div> or a <span> tag |
optional, defaults to <span> |
%TWISTYSHOW{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
id |
Unique identifier | Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]] | required |
link |
Link label | Show link label | optional |
mode |
"div" or "span" |
Specify if the Twisty Show link will use a <div> or a <span> tag |
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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 ). |
optional, default no initial state |
%TWISTYSHOW{id="demo" link=" Click to Unfold " imgleft="%ICONURLPATH{toggleopen}%"}%
%TWISTYHIDE{id="myid" ... }%
Parameter | Value | Description | Remark |
---|---|---|---|
id |
Unique identifier | Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]] | required |
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 |
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 [[TWiki/TWikiVariables#VarICONURLPATH]] to display one of the [[TWiki/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 ). |
optional, default no initial state |
%TWISTYHIDE{id="demo" link=" Click to Fold " imgleft="%ICONURLPATH{toggleclose}%"}%
%TWISTYTOGGLE{id="myid"}%
Parameter | Value | Description | Remark |
---|---|---|---|
id |
Unique identifier | Used to link [[Main/WebHome#VarTWISTYSHOW]], [[Main/WebHome#VarTWISTYHIDE]] and [[Main/WebHome#VarTWISTYTOGGLE]]. | required |
mode |
"div" or "span" |
Specify if the Twisty Toggle section will use a <div> or a <span> tag. |
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 ). |
optional, default no initial state |
noscript |
"hide" |
Make content hidden in case use does not have JavaScript on | optional, default content is shown with no JavaScript |
%TWISTYTOGGLE{id="demo" mode="div" remember="on"}%My content%ENDTWISTYTOGGLE%
%ENDTWISTYTOGGLE%
%ENDTWISTYTOGGLE%
**%<plugin>\_<setting>%**
, i.e. **%TWISTYPLUGIN\_SHORTDESCRIPTION%**
- 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
- Set SHORTDESCRIPTION = Twisty section JavaScript library to open/close content dynamically
- Set DEBUG = 0
## Plugin Installation Instructions
- Download the ZIP file from the Plugin web (see below)
- Unzip **%TOPIC%.zip**
in your root ($TWIKI\_ROOT) directory. Content: File: | Description: |
---|---|
TwistyBundleTWiki04x02_installer |
|
TwistyBundleTWiki04x02_installer.pl |
|
data/TWiki/TwistyBundleTWiki04x02.txt |
|
data/TWiki/BehaviourContrib.txt |
|
data/TWiki/TwistyContrib.txt |
|
data/TWiki/TwistyPlugin.txt |
|
lib/TWiki/Contrib/BehaviourContrib.pm |
|
lib/TWiki/Contrib/TwistyBundleTWiki04x02.pm |
|
lib/TWiki/Contrib/TwistyContrib.pm |
|
lib/TWiki/Plugins/TwistyPlugin.pm |
|
pub/TWiki/BehaviourContrib/behaviour.compressed.js |
|
pub/TWiki/BehaviourContrib/behaviour.compressed_src.js |
|
pub/TWiki/BehaviourContrib/behaviour.js |
|
pub/TWiki/BehaviourContrib/behaviour_src.js |
|
pub/TWiki/BehaviourContrib/cssQuery/cssQuery-p.js |
|
pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-level2.js |
|
pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-level3.js |
|
pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery-standard.js |
|
pub/TWiki/BehaviourContrib/cssQuery/src/cssQuery.js |
|
pub/TWiki/BehaviourContrib/cssQuery/src/test.html |
|
pub/TWiki/BehaviourContrib/cssQuery/test.html |
|
pub/TWiki/TwistyContrib/twist.compressed.js |
|
pub/TWiki/TwistyContrib/twist.compressed_src.js |
|
pub/TWiki/TwistyContrib/twist.css |
|
pub/TWiki/TwistyContrib/twist.js |
|
pub/TWiki/TwistyContrib/twist_src.js |
**%TOPIC%\_installer**
to automatically check and install other TWiki modules that this module depends on. You can also do this step manually.
- Alternatively, manually make sure the dependencies listed in the table below are resolved. None
- Visit `configure` in your TWiki installation, and enable the plugin in the \{Plugins\} section.
## Plugin Info
Authors: | TWiki:Main.RafaelAlvarez, TWiki:Main.ArthurClemens |
Copyright ©: | 2005 Rafael Alvarez; 2006, 2007 Arthur Clemens |
License: | GPL |
Dependencies: | None |
Plugin Version: | 03 Aug 2008 (version 1.4.10) |
Change History: | |
03 Aug 2008 | 1.4.10 TWiki 4.2.1 release version |
13 Dec 2007 | 1.4.9 fix to the loading order of javascript files in head |
24 Nov 2007 | 1.4.6 - 1.4.8 Arthur Clemens - Added format tokens. |
07 Oct 2007 | 1.4.5 Arthur Clemens - Fix html tag with show/hide controls. |
25 Sep 2007 | 1.4.4 Arthur Clemens - Fix rendering of headers when prefix is used. |
11 Jul 2007 | 1.4.3 Arthur Clemens - Fix invalid html when prefix and suffix is used. |
23 Jun 2007 | 1.4.2 Arthur Clemens - Fixed bugs with parameters firststart and noscript (since version 1.4). |
20 Jun 2007 | 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 |
11 June 2006 | 1.100 Added parameters start , firststart , noscript and class ; complete JavaScript rewrite for speed |
12 Sep 2005 | 1.000 First Version |
Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |