Cross-browser longest transition getter
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.js
index.umd.js
package.json

README.md

longest-transition

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status Greenkeeper badge

Cross-browser longest transition getter.

This module reads all transitions of an element and provides the longest one.

import longestTransition from 'longest-transition';
// or
const longestTransition = window.longestTransition;

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

const time = longestTransition(element);
/*
    `time` will be something like:

    {
        property: 'height',
        duration: 200,
        delay: 100
    }

    Note that time is in milliseconds
*/

Installation

$ npm install longest-transition

Usage

longestTransition(element)
  • element: The element that is transitioning.
  • Returns an object in the format below.
{
    property: 'height',
    duration: 200, // milliseconds
    delay: 100  // milliseconds
}

Tests

$ npm test
$ npm test-cov to get coverage report

License

Released under the MIT License.