.hide( effect [, options ] [, duration ] [, complete ] )Returns: jQuery
Description: 使用自定义的效果隐藏匹配的元素。
-
.hide( effect [, options ] [, duration ] [, complete ] )
-
effectType: String一个字符串,指示哪个特效被使用。
-
optionsType: Object特效选项和缓冲函数。duration (default:
400
)一个字符串或者数字决定动画将运行多久。(注:三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000) )completeType: Function()在动画完成时执行的函数。.hide( options )
-
optionsType: Object全部动画选项。 只有一个必须设置的属性
effect
。-
effectType: String一个字符串,指示哪个特效被使用。
-
easing (default:
"swing"
)Type: String一个字符串,表示过渡使用哪种 缓动 函数。 -
duration (default:
400
)一个字符串或者数字决定动画将运行多久。(注:三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000) ) -
completeType: Function()在动画完成时执行的函数。
-
queue (default:
true
)一个布尔值,指示是否将动画放置在效果队列中。如果为false时,将立即开始动画。 从jQuery1.7开始,队列选项也可以接受一个字符串,在这种情况下, 在动画被添加到由该字符串表示的队列中。
-
这个插件扩展了jQuery中的
.hide()
方法。 如果没有加载 jQuery UI,调用.hide()
方法可能不会失败,因为方法仍然存在。 然而,预期的行为(注:指平滑过渡动画效果)将不会发生。Example:
使用拖动特效切换显示div。
123456789101112131415161718192021222324252627282930<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hide demo</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<style>
div {
width: 100px;
height: 100px;
background: #ccc;
border: 1px solid #000;
}
</style>
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<button>hide the div</button>
<div></div>
<script>
$( "button" ).click(function() {
$( "div" ).hide( "drop", { direction: "down" }, "slow" );
});
</script>
</body>
</html>
Demo:
-