Slide Toggle In Vanilla JavaScript – slideToggle.js

Category: Animation , Javascript | February 15, 2022
Author:ericbutler555
Views Total:521 views
Official Page:Go to website
Last Update:February 15, 2022
License:MIT

Preview:

Slide Toggle In Vanilla JavaScript – slideToggle.js

Description:

slideToggle.js is a vanilla JavaScript library to implement performant slideToggle, slideUp, and slideDown functionalities using requestAnimationFrame.

The goal of this library is to animate the height of matched elements similar to jQuery’s slideToggle method.

See Also:

How to use it:

1. Insert the minified version of the slideToggle.js and we’re ready to go.

<script src="slideToggle.min.js"></script>

2. Apply the slide toggle to an element.

  • duration: Defaults to 40
  • callback: Optional
element.slideToggle(duration, callback);
element.slideUp(duration, callback);
element.slideDown(duration, callback);

Changelog:

v2.0.0 (02/15/2022)

  • move element from function param to object, to better mirror jquery

You Might Be Interested In:


Leave a Reply