jQuery UI API - 尺寸特效(Size Effect)
所屬類別
用法
描述:調整元素尺寸到指定寬度和高度。
size
| 參數 | 類型 | 描述 | 默認值 |
|---|---|---|---|
| to | Object | 要調整到的高度和寬度。 | |
| origin | Array | 消失點。 | [ "top", "left" ] |
| scale | String | 元素的哪個區域將被調整尺寸:"both"、"box"、"content"。當值為 "box" 時,調整元素的邊框(border)和內邊距(padding)的尺寸。當值為 "content" 時,調整元素內的所有內容的尺寸。 | "both" |
實例
使用尺寸特效(Size Effect)調整元素尺寸。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>尺寸特效(Size Effect)演示</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<style>
#toggle {
width: 100px;
height: 100px;
background: #ccc;
}
</style>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<p>點擊任意地方進行尺寸調整。</p>
<div id="toggle"></div>
<script>
$( document ).click(function() {
$( "#toggle" ).effect( "size", {
to: { width: 200, height: 60 }
}, 1000 );
});
</script>
</body>
</html>
