Two simple utils to slide an element up or down from hidden to full height.
- Source
Methods
(inner) down(elem, id, time, callback) → {void}
A utility to reveal some hidden content with a slide down animation. Element to slide should get the following CSS: max-height: 0; overflow: hidden;
Parameters:
Name | Type | Description |
---|---|---|
elem | Node | | Element to show. |
id | string | Unique ID of animation. |
time | number | Length of animation. |
callback | function | Callback function. |
- Since
- 1.0.0
- Source
Requires:
Returns:
- Type:
- void
Example
import { slide } from "@gravityforms/utils";
function Example() {
const target = getNodes( 'example' )[ 0 ];
const callback = () => {
//do something after animation
};
slide.down( target, example, 800, callback );
}
(inner) up(elem, id, time, callback) → {void}
A utility to hide some content with a slide up animation. Element to slide should get the following CSS: max-height: 0; overflow: hidden;
Parameters:
Name | Type | Description |
---|---|---|
elem | Node | | Element to hide. |
id | string | Unique ID of animation. |
time | number | Length of animation. |
callback | function | Callback function. |
- Since
- 1.0.0
- Source
Requires:
Returns:
- Type:
- void
Example
import { slide } from "@gravityforms/utils";
function Example() {
const target = getNodes( 'example' )[ 0 ];
const callback = () => {
//do something after animation
};
slide.up( target, example, 800, callback );
}