问题
It seems like after calling both result is the same.
回答1:
The show
/hide
methods animates width, height and opacity, while slideUp
/sideDown
only animates the height.
The default duration of show
/hide
is zero, so if you don't specify a duartion it will show/hide the element immediately.
If you are not seeing any difference between the methods, then they are most likely not working propery with the element that you apply them to. A common reason for that is that you are testing in Internet Explorer, and the element doesn't have the layout flag. If you for example try to animate a table cell, the style changes that the animation does on the element won't apply, and you will just see that the element is shown/hidden.
回答2:
slideDown()
and slideUp()
animates the hiding/showing.
回答3:
jQuery's hide
method will simply apply display: none
to the selected element(s), unless a duration is provided - then it will animate. The slide methods are members of the effects queue, they will hide/show the element(s) in a sliding motion.
回答4:
hide()
instantly hides the div.
while slidetoggle(), slidedown() & slideup()
do the same with some animation effects. there is some sliding effects in these functions. thats the difference.
nothing else.
Hope this helps.
回答5:
hide() simply sets the display: none
CSS attribute unless you specify a duration. If you do so, it will fade out.
slideUp() is always animated.
The same applies for show()
and slideDown()
.
回答6:
The only diffrence that exists between hide() and slideup () /slidedown() is the animation. Slide up/down will simply slide and hide will simply hide. The two methods can be used with a duration / easing option. for more information http://api.jquery.com/hide/ and http://api.jquery.com/slideUp/
来源:https://stackoverflow.com/questions/7187476/what-is-the-difference-between-jquerys-hide-and-slidedown-slideup