@modernice/animate-height
TypeScript icon, indicating that this package has built-in type declarations

0.0.15 • Public • Published

animate-height

Animate the height of an element to 'auto' or '0px'.

Install

CDN

<script src="https://unpkg.com/animate-height"></script>

Node

npm install animate-height --save # or yarn add animate-height

Usage

Animate to auto

import { autoHeight } from 'animate-height'

const el = document.querySelector('#example')

const height = await autoHeight(el, {
  duration: 250,
  timing: 'cubic-bezier(.91, .06, .08, .93)',
})

console.log(`Element has a height of ${height}px.`)

Animate to 0px

import { zeroHeight } from 'animate-height'

const el = document.querySelector('#example')

await zeroHeight(el, {
  duration: 500,
  timing: 'ease-out',
})

Default options

autoHeight(el, {
  duration: 300, // Transition duration
  timing: 'ease', // CSS transition timing function
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.15
    1
    • latest

Version History

Package Sidebar

Install

npm i @modernice/animate-height

Weekly Downloads

1

Version

0.0.15

License

MIT

Unpacked Size

81.2 kB

Total Files

15

Last publish

Collaborators

  • bono