JQuery的hide()和slideDown()/slideUp()有什么区别? [英] What is the difference between JQuery's hide() and slideDown()/slideUp()?
问题描述
在调用两个结果后似乎都是相同的.
It seems like after calling both result is the same.
推荐答案
show
/hide
方法可对宽度,高度和不透明度进行动画处理,而slideUp
/sideDown
仅可对高度进行动画处理.
The show
/hide
methods animates width, height and opacity, while slideUp
/sideDown
only animates the height.
show
/hide
的默认持续时间为零,因此,如果您未指定双历元,它将立即显示/隐藏该元素.
The default duration of show
/hide
is zero, so if you don't specify a duartion it will show/hide the element immediately.
如果您发现方法之间没有任何区别,则它们很可能无法与您应用它们的元素一起正常工作.常见的原因是您正在Internet Explorer中进行测试,并且该元素没有布局标志.例如,如果尝试为表格单元设置动画,则该动画对元素所做的样式更改将不会应用,您只会看到该元素已显示/隐藏.
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.
这篇关于JQuery的hide()和slideDown()/slideUp()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!