in-out-transitioner
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

in-out-transitioner

Easily transition elements in and out with CSS

Install

$ npm install in-out-transitioner

Usage

import createTransition from 'in-out-transitioner';

const element = document.getElementById('element');

const transitioner = createTransition(element, {
    // default: element
    container: document.getElementById('container'),
    enterFromClass: 'enter-from',
    enterActiveClass: 'enter-active',
    enterToClass: 'enter-to',
    leaveFromClass: 'leave-from',
    leaveActiveClass: 'leave-active',
    leaveToClass: 'leave-to',
    onBeforeEnter: () => {},
    onEnter: () => {},
    onAfterEnter: () => {},
    onEnterCancelled: () => {},
    onBeforeLeave: () => {},
    onLeave: () => {},
    onAfterLeave: () => {},
    onLeaveCancelled: () => {},
});

element.addEventListener('click', () => {
    transitioner.isEntering() || transitioner.isEntered()
        ? transitioner.leave()
        : transitioner.enter();
});

Package Sidebar

Install

npm i in-out-transitioner

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

10.2 kB

Total Files

5

Last publish

Collaborators

  • wwwoda