Background:
I ran into a problem that I find somewhat unexpected. I have a small jQuery module where I used .slideToggle() to show / hide an element and it works fine. Today I am implementing two publicly available methods for my plugin to show or hide an element using a sliding effect.
Simpler as it sounds, although I would just use .slideUp() and slideDown() to accomplish the same thing. I was very surprised when I realized that nothing happened when these methods were called in the element.
As a side note, calling .show() and .hide() also fine, but without the desired animation.
I always thought that .slideToggle() implemented the same functionality as .slideUp() and .slideDown() "under the hood", but apparently this is not the case.
My question is:
What is the difference .slideToggle() and .slideUp() and .slideDown() and what should I consider when using one of them compared to the others?
Refresh, for example:
I was able to break it down into the most important components needed to reproduce this error in this fiddle . You can comment on .slideToggle("slow") and .slideUp("slow") respectively to test it. It works with slideToggle, with slideUp it does not.
source share