Two simple utils to slide an element up or down from hidden to full height.

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:
NameTypeDescription
elemNode | HTMLElement

Element to show.

idstring

Unique ID of animation.

timenumber

Length of animation.

callbackfunction

Callback function.

Since
  • 1.0.0
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:
NameTypeDescription
elemNode | HTMLElement

Element to hide.

idstring

Unique ID of animation.

timenumber

Length of animation.

callbackfunction

Callback function.

Since
  • 1.0.0
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 );
}