Author: | ericbutler555 |
---|---|
Views Total: | 2,332 views |
Official Page: | Go to website |
Last Update: | February 15, 2022 |
License: | MIT |
Preview:

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:
- Toggle Element With Smooth CSS3 Transitions – slide-element
- Versatile Sliding Box In JavaScript – slideBlock.js
- Animated slideUp & slideDown Of Elements In Pure JavaScript – dom-slider
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