.show()


.show( effect [, options ] [, duration ] [, complete ] )Returns: jQuery

Description: 使用自定义特效显示匹配的元素。

  • .show( effect [, options ] [, duration ] [, complete ] )

    • effect
      Type: String
      一个字符串,指示哪个特效被使用。
    • options
      Type: Object
      特效选项和缓冲函数
    • duration (default: 400)
      Type: Number or String
      一个字符串或者数字决定动画将运行多久。(愚人码头注:三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000) )
    • complete
      Type: Function()
      在动画完成时执行的函数。
  • .show( options )

    • options
      Type: Object
      全部动画选项。 只有一个必须设置的属性effect
      • effect
        Type: String
        一个字符串,指示哪个特效被使用。
      • easing (default: "swing")
        Type: String
        一个字符串,表示过渡使用哪种 缓动 函数
      • duration (default: 400)
        Type: Number or String
        一个字符串或者数字决定动画将运行多久。(愚人码头注:三种预定速度的字符串("slow", "normal", 或 "fast")或表示动画时长的毫秒数值(如:1000) )
      • complete
        Type: Function()
        在动画完成时执行的函数。
      • queue (default: true)
        Type: Boolean or String
        一个布尔值,指示是否将动画放置在效果队列中。如果为false时,将立即开始动画。 从jQuery1.7开始,队列选项也可以接受一个字符串,在这种情况下, 在动画被添加到由该字符串表示的队列中。

这个插件扩展了jQuery中的.show()方法。 如果没有加载 jQuery UI,调用.show()方法可能不会失败,因为方法仍然存在。 然而,预期的行为(愚人码头注:指平滑过渡动画效果)将不会发生。

Example:

使用折叠特效显示div。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>show demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<style>
div {
display: none;
width: 100px;
height: 100px;
background: #ccc;
border: 1px solid #000;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<button>show the div</button>
<div></div>
<script>
$( "button" ).click(function() {
$( "div" ).show( "fold", 1000 );
});
</script>
</body>
</html>

Demo: