jQuery slideToggle slideUp slideDown Replacement – SimpleSlideToggle.js

Category: Image | June 8, 2021
Author:maekoya
Views Total:173 views
Official Page:Go to website
Last Update:June 8, 2021
License:MIT

Preview:

jQuery slideToggle slideUp slideDown Replacement – SimpleSlideToggle.js

Description:

A vanilla JavaScript implementation of slideUp & slideDown animations. Use it to reveal & hide given elements with a smooth slide effect without jQuery dependency.

See Also:

How to use it:

1. Install & Download.

# NPM
$ npm i simple-slide-toggle

2. Import the simpleSlideToggle.js JavaScript library.

import { slideUp, slideDown, slideToggle } from 'simple-slide-toggle'
<script src="./dist/simpleSlideToggle.js"></script>

3. Toggle the visibility of an element.

<div
  id="example"
  aria-hidden="true"
  aria-expanded="false">
  Show/Hide Me
</div>
const $target = document.getElementById('example')
slideToggle($target);

4. Specify the animation speed.

slideToggle($target, 500);

You Might Be Interested In:


Leave a Reply