The logic is pretty simple—if the target is hidden i.e. Finally remove all the additional properties after the animation completes. the API documentation. Toggling between slideUp and slideDown becomes pretty easy.

The SlideToggle() animation method is used to slideToggle() (hide/show) the selected Html elements. If the HTML element is hidden or already slided up, slideToggle() method makes them slide down. Here is the simple syntax to use this method −, Here is the description of all the parameters used by this method −. We push blog updates with the help of Feedburner.

The jQuery slideToggle() method show or hide the selected elements by decreasing or increasing their heigh. Note that this again is to be explicitly inside the slideDown function. Syntax: speed: It specifies the speed of the delay. my target slideToggle() div needs to be display:inline-block instead of display:block when it's open. And that’s our slideUp function written in plain JavaScript. Try it Yourself - Examples. You'll get a notification every time a post gets published here. But none was as smooth as jQuery’s slideUp, slideDown, and slideToggle. Edit: i'm using jQuery 1.7.0 at the moment. This doesn’t support the left and right support yet. Here is the description of all the parameters used by this method − search Search jQuery API Documentation. Is there a way to change the jquery behavior here? This will keep things simple. This can be done by adding the height and transition properties to the target element. If false, the animation will begin immediately. Do the following things when the animation gets completed: And that was our slideDown function. 1000). The jQuery library comes with a plenty of tempting features which also make it too heavy in file size i.e approx 85KB. Ask Question Asked 7 years, 10 months ago. I’ll surely be adding all that stuff in future. In the following example we are applying the slide toggle effect on the paragraph, on the h2 element click event, we are calling slideToggle() method on paragraph, which will make the paragraph disappear with a slide up effect and when we click the h2 heading again, the paragraph will reappear with a slide down effect.. jQuery slideToggle method is used to toggle between slideUp() and slideDown() method. The slideToggle() method toggles between slideUp() and slideDown() for the selected html elements. And then add this pinch of JavaScript after you add all the above discussed code, wrapped in the