jQuery的hide和slideUp方法是否相同? [英] Are jQuery's hide and slideUp methods equivalent?

查看:136
本文介绍了jQuery的hide和slideUp方法是否相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行 slideUp('慢')隐藏('慢')会产生相同的动画效果吗?

Do slideUp('slow') and hide('slow') result in the same animation effects?

示例代码:

$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide('slow');
  });
  $("#show").click(function(){
    $("p").show('slow');
  });
});


<p>If you click on the "Hide" button, I will disappear.</p>
<button id="hide">Hide</button>
<button id="show">Show</button>


推荐答案

否。

.slideUp('slow')将高度和垂直填充设置为零。

.hide ('慢')还可以将宽度,水平填充和不透明度设置为零。

.slideUp('slow') animates the height and vertical padding to zero.
.hide('slow') also animates the width, horizontal padding, and opacity to zero.

要查看差异,请粘贴 javascript:void($('pre')。hide(4000))在此页面的地址栏中。

To see the difference, paste javascript:void($('pre').hide(4000)) in the address bar in this page.

这篇关于jQuery的hide和slideUp方法是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆