https://github.com/bkwld/toggleable
Show and hide elements when other elements are clicked
https://github.com/bkwld/toggleable
Last synced: about 1 year ago
JSON representation
Show and hide elements when other elements are clicked
- Host: GitHub
- URL: https://github.com/bkwld/toggleable
- Owner: BKWLD
- License: mit
- Created: 2016-01-11T20:14:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-11T20:19:13.000Z (over 10 years ago)
- Last Synced: 2025-03-05T10:02:06.178Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Toggleable
Show and hide elements when other elements are clicked
## API
- **map(array mapping)**
Provide a mapping of elements to OTHER elements that should be shown when clicked. `mapping` is an array of objects that look like: `{ on: $el, show: $el}`. When the on $el is clicked, all the `show` $elements but the one in the pairing are hidden.
## Examples
```js
require('toggleable').map([
{ on: $('.one'), show: $('other') },
{ on: $('.two'), show: $('another') }
]).showFirst();
```