1.0.0 • Published 7 years ago

@odyzeo/toggle v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

zeo-toggle

Installation

npm i zeo-toggle

or

yarn add zeo-toggle

Usage

<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

AttributeRequiredDescriptionDefault
data-toggleREQUIREDselector for search in scope'.js-toggle-element'
data-toggle-scopeOPTIONALscope to search toggle element use selector to find closest parent this, document, .selectordocument
data-toggle-modeOPTIONALmode for toggling click, hover'click'
data-toggle-off-clickOPTIONALoff click close toggle elementfalse
data-toggle-groupOPTIONALenables only one element active at timefalse

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint