Author: | ericbutler555 |
---|---|
Views Total: | 60 views |
Official Page: | Go to website |
Last Update: | December 28, 2020 |
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.
slideToggle(element); slideUp(element); slideDown(element);
3. Determine the duration of the slide animation. Default: 400.
slideToggle(element, 1000); slideUp(element, 1000); slideDown(element, 1000);
4. Trigger a function when the animation is completely finished.
slideToggle(element, 1000, function(){ // do something }); slideUp(element, 1000, function(){ // do something }); slideDown(element, 1000, function(){ // do something });