Skip to content

ericweerstra/toggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toggle

Makes toggling DOM elements easy and adjustable.

Demo
Demo code

Basic example

<a id="trigger"
   data-module="toggle/Trigger"
   data-options='{"targets":"toggle"}'>Trigger</a>
   
<p id="toggle"
   data-module="toggle/Toggle"'>Toggle</p>

Trigger options

  • targets - Comma separated string of (multiple) toggle id's
  • toggle - Set this options to true if you want the trigger to act like a toggle itself
  • event - Trigger event, default is 'click'
  • method - Options are 'activate', 'deactivate' and (default) 'switch'
  • preventDefault - Cancel the event, default is true
  • group - Optional group name

Toggle options

  • attribute - The Toggle attribute, default is data-toggle-active but it can be a Aria attribute like aria-hidden
  • activeState - Value for the Toggle active state attribute, default true
  • inActiveState - Value for the Toggle inactive state attribute, default false
  • group - Optional group name

Requirements

Uses ConditionerJS for initialization but it can be used without.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published