Skip to content

Simple class toggler inspired by Zurb Foundation's one.

Notifications You must be signed in to change notification settings

marcomessa/toggler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Toggler

This was inspired by Zurb Foundation's one.

With Toggler you can easly set up class changes on click events, without worring of writing the same js code every time.

Inside your markup add data-toggle="myId" on your button element (or any other element you wont to interact with) and data-toggler="all the classes you want to toggle" to your target element. You can toggle many id with a single item and

Installation

npm install @marcomessa/toggler

Usage

In you main js file:

import Toggler from '@marcomessa/toggler';
const toggler = new Toggler;

In your markup

<div id="myId" data-toggler="class1 class2 class3"></div>
<div id="myOtherId" data-toggler="class2 class3"></div>

<button data-toggle="myId">Button 1</button>
<button data-toggle="myId myOtherId">Button 2</button>

About

Simple class toggler inspired by Zurb Foundation's one.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published