https://github.com/towardstudio/bluegg-toggle
https://github.com/towardstudio/bluegg-toggle
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/towardstudio/bluegg-toggle
- Owner: towardstudio
- Created: 2016-08-26T15:13:36.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-30T08:44:38.000Z (almost 10 years ago)
- Last Synced: 2025-08-09T02:37:21.908Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bluegg Toggle
Declarative toggle using data attributes
## Wut?
The JS simply adds a class of ```is-toggled``` to a specific target(s).
Your target is specified in a data attribute (```data-toggle-target="my-thing"```). The target then needs to have a ```data-toggle-name="my-thing"``` attribute. The target can be a single target or comma separated list (e.g. ```data-toggle-target="my-thing,my-other-thing"```). You can optionally specify a ```data-target-action="on"``` (on or off) that can be used to only allow the control to add/remove the ```is-toggled``` class.
## Huh?
Usage in JS:
```js
var toggle = require('bluegg-toggle');
toggle();
```
[See here for style and markup example](http://codepen.io/matthewbeta/pen/qNzZRO?editors=1010)