开发者

What is the difference between JQuery's hide() and slideDown()/slideUp()?

It seems like after calling 开发者_如何学JAVAboth result is the same.


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.


slideDown() and slideUp() animates the hiding/showing.


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.


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.


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().


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/


hide() means it reduce the height ,width and opacity attribute value until height=0,width=0 and opacity=0 and (padding and margin are optional if the value are not zero then it also reduce the value to zero)

slideUp() means it reduce the attribute value until zero those attribute are height,margin-top,margin-bottom,padding-top and padding-bottom

slideDown() is reverse of slideUp() it increase the value until the actual, define in our source code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜