Animate the height of an element to 'auto' or '0px'.
npm install animate-height> Animate the height of an element to 'auto' or '0px'.
CDN
``html`
Node
`bash`
npm install animate-height --save # or yarn add animate-height
`js
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.)`
`js
import { zeroHeight } from 'animate-height'
const el = document.querySelector('#example')
await zeroHeight(el, {
duration: 500,
timing: 'ease-out',
})
`
`js``
autoHeight(el, {
duration: 300, // Transition duration
timing: 'ease', // CSS transition timing function
})