You are here: System » JQTwistyContrib

JQTwistyContrib

Lightweight twisty plugin

JQTwistyContrib is a lightweight twisty plugin implementing a subset of the features provided by TwistyPlugin, but using javascript only. This comes in handy when a twisty is needed but without having to render it using the Foswiki backend server.

A "twisty" is a collabsable area to hide/show certain areas of a webpage.

Usage

A twisty consists of two elements: a trigger and a container. When the trigger is clicked by the user, the container will be collapsed or expanded. The behavior of the twisty is configured using html5 data attributes part of the trigger element. Use the jqTwisty css class to install the twisty on a trigger element. The toggle container is then specified using a target argument, defaulting to the next adjacent html node in the tree,

<a class='jqTwisty'>click me</a>
<div>
Here comes the container.
</div>

Parameter

Name Description Default
openText text of the trigger button when the container is hidden html text of the trigger element
closeText text to be displayed when the container is shown same as openText
openImg url of an image displayed when the container is hidden  
closeImg url of an image displayed when the container is shown  
initialState initial state of the container: can be 'open' or 'close' close
target jquer selector of container(s) to toggle their visibility next html node following the twisty trigger

Events

State change events

JQTwistyContrib will fire an event according to the state changes of the twisty. That way you'll be able to bind additional behaviors on its base, for instance when the twisty is fully open.

Event Description
inited.twisty the twisty has been initialized
beforeOpen.twisty the twisty is about to be opened
afterOpen.twisty the twisty has been opened
beforeClosed.twisty the twisty is about to be closed
afterClose.twisty the twisty has been closed

Access events

You might also fire an event on the twisty itself to change the state from within javascript. See the accordion example below coordinating multiple twisties.

Event Description
open.twisty opens the twist
close.twisty closes the twist

Examples

Simple

open
Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

Has ei inermis ponderum, senserit recteque quo ne. Reque sadipscing te vim, eu possit labores platonem eam, pri debet accusam copiosae ea. Alii graeci verear in pri. Vel cu graeco nonumes maiorum, legere comprehensam has ad. Graece petentium vix ne, aliquip recusabo te pri.

Vim ad dicunt mentitum tacimates, his at illud suavitate. Ubique dictas deserunt mea ut. Idque labore inciderint in his, ad saepe eruditi erroribus his. Phaedrum argumentum ex vis. In iusto exerci scaevola mel, ex expetendis scripserit sit.

Omnis copiosae vix ad, per oratio suscipiantur ad. Est ne congue verear comprehensam. Nec mucius dicunt dignissim te, cu qui laoreet fastidii, iriure propriae appellantur cum eu. Ea vis dicat novum, feugiat tractatos interesset in ius, vel wisi offendit te. Possit feugiat similique per at, viris verear an quo.

Iusto suscipiantur at pri. Qui aliquid delenit ad, ex eos porro cotidieque. Wisi velit sea ex, nec sale molestiae an. Duo minim inermis recusabo cu, vel utinam oporteat ad, amet brute usu ut. Scribentur philosophia in mea. In iuvaret fierent sadipscing ius, in possit alienum pro.

Multiple containers

open

Omnis copiosae vix ad, per oratio suscipiantur ad. Est ne congue verear comprehensam. Nec mucius dicunt dignissim te, cu qui laoreet fastidii, iriure propriae appellantur cum eu. Ea vis dicat novum, feugiat tractatos interesset in ius, vel wisi offendit te. Possit feugiat similique per at, viris verear an quo.

Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

State changes

open
Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

Has ei inermis ponderum, senserit recteque quo ne. Reque sadipscing te vim, eu possit labores platonem eam, pri debet accusam copiosae ea. Alii graeci verear in pri. Vel cu graeco nonumes maiorum, legere comprehensam has ad. Graece petentium vix ne, aliquip recusabo te pri.

Vim ad dicunt mentitum tacimates, his at illud suavitate. Ubique dictas deserunt mea ut. Idque labore inciderint in his, ad saepe eruditi erroribus his. Phaedrum argumentum ex vis. In iusto exerci scaevola mel, ex expetendis scripserit sit.

Omnis copiosae vix ad, per oratio suscipiantur ad. Est ne congue verear comprehensam. Nec mucius dicunt dignissim te, cu qui laoreet fastidii, iriure propriae appellantur cum eu. Ea vis dicat novum, feugiat tractatos interesset in ius, vel wisi offendit te. Possit feugiat similique per at, viris verear an quo.

Iusto suscipiantur at pri. Qui aliquid delenit ad, ex eos porro cotidieque. Wisi velit sea ex, nec sale molestiae an. Duo minim inermis recusabo cu, vel utinam oporteat ad, amet brute usu ut. Scribentur philosophia in mea. In iuvaret fierent sadipscing ius, in possit alienum pro.

Accordion

Section 1

Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

Section 2

Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

Section 3

Lorem ipsum dolor sit amet, ius ne dico constituto neglegentur. Vix ornatus platonem in, inermis corpora at has. Ea mucius viderer eligendi vim, quis iuvaret ceteros mea at. Ea vim ullum consequuntur, propriae concludaturque vis ex, cu melius phaedrum vix. Debet possit definitiones eos ea. In mel tibique incorrupte.

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Info

Change History:  
17 Jul 2015: added css classes to indicate twisty state
15 Mar 2014: fixed syntax error in contrib stub
13 Dec 2013: support html elements to be used as twisty toggles
12 Jun 2012: initial release
Dependencies:
NameVersionDescription
Foswiki::Plugins::JQueryPlugin>=4.00Required.
Home page: Foswiki:Extensions/JQTwistyContrib

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding AustLII Communities? Send feedback
This website is using cookies. More info. That's Fine