jQuery slideToggle: Main Tips
- The
.slideToggle()
method alternates between the slideUp() and slideDown() methods each time it is applied. - This method can be used to animate the height of any element (i.e., an image).
- jQuery toggle slide belongs to the group of slide effects.
How to Toggle Slide Animations
The jQuery .slideToggle()
method alternates between the .slideUp() and .slideDown() methods each time it is applied. In the example below, you can use the same button to both show and hide an image with slide animations:
To toggle slide animations, follow these syntax rules:
$("selector").slideToggle(length, easing, callback);
jQuery .slideToggle()
accepts three arguments:
length
- a numeric value (400
by default), indicating how many milliseconds that the animation lasts. Keywords can be used as well:slow
(600 ms) andfast
(200 ms).easing
- a keyword (eitherlinear
orswing
), indicating the changes in the animation speed.callback
- the name of the function that will run after the animation.
Latest Coupon Found:
Verified STAFF PICK
TOP-RATED CODING COURSES
Learn the skills of tomorrow
The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!
Expiration date: 18/04/2021
2287 People Used
Only 92 Left