Size Effect


Size Effect

Description: 将元素的尺寸设置到一个指定的宽度和高度。

  • size

    • to
      Type: Object
      改变后高和宽。
    • origin (default: [ "top", "left" ])
      Type: Array
      特效起始的方向。
    • scale (default: "both")
      Type: String
      确定元素的哪个区域将被缩放: "both", "box", "content"。Box值缩放元素的border和padding; content值缩放元素内部的所有内容。

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>size demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<style>
#toggle {
width: 100px;
height: 100px;
background: #ccc;
}
</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>
<p>Click anywhere to resize the box.</p>
<div id="toggle"></div>
<script>
$( document ).click(function() {
$( "#toggle" ).effect( "size", {
to: { width: 200, height: 60 }
}, 1000 );
});
</script>
</body>
</html>

Demo: