1.0.0 • Published 7 years ago
@odyzeo/toggle v1.0.0
zeo-toggle
Installation
npm i zeo-toggleor
yarn add zeo-toggleUsage
<style>
.js-toggle-element {
height: 0; /* Remove when you want toggle already open */
overflow: hidden;
transition: height .2s;
}
</style>
<button data-toggle=".js-toggle-element">
Click
</button>
<div class="js-toggle-element">
Lorem ipsum dolor sit amet
</div>import toggle from 'zeo-toggle';
toggle();Options
| Attribute | Required | Description | Default |
|---|---|---|---|
| data-toggle | REQUIRED | selector for search in scope | '.js-toggle-element' |
| data-toggle-scope | OPTIONAL | scope to search toggle element use selector to find closest parent this, document, .selector | document |
| data-toggle-mode | OPTIONAL | mode for toggling click, hover | 'click' |
| data-toggle-off-click | OPTIONAL | off click close toggle element | false |
| data-toggle-group | OPTIONAL | enables only one element active at time | false |
Compiles and hot-reloads for development
npm run serveCompiles and minifies for production
npm run buildLints and fixes files
npm run lint1.0.0
7 years ago