jQuery UI API - scaling effects (Scale Effect)
category
usage
Description: In accordance with a percentage scale elements.
scale
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
direction | String | 特效的方向。可能的值:"both"、"vertical" 或 "horizontal"。 | "both" |
origin | Array | 消失点。 | [ "middle", "center" ] |
percent | Number | 要缩放到的百分比。 | |
scale | String | 元素的哪个区域将被调整尺寸:"both"、"box"、"content"。当值为 "box" 时,调整元素的边框(border)和内边距(padding)的尺寸。当值为 "content" 时,调整元素内的所有内容的尺寸。 | "both" |
Examples
Example 1:Use the zoom effects (Scale Effect) switching a div.
<! Doctype html> <Html lang = "en"> <Head> <Meta charset = "utf-8"> <Title> Zoom effects (Scale Effect) Demo </ 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> Click anywhere to switch. </ P> <Div id = "toggle"> </ div> <Script> $ (Document) .click (function () { $ ( "#toggle") .toggle ( "Scale"); }); </ Script> </ Body> </ Html>Example 2:
Only use the zoom effects (Scale Effect) in one direction to switch a div.
<! Doctype html> <Html lang = "en"> <Head> <Meta charset = "utf-8"> <Title >> zoom effects (Scale Effect) Demo </ 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> Click anywhere to switch. </ P> <Div id = "toggle"> </ div> <Script> $ (Document) .click (function () { $ ( "#toggle") .toggle ({Effect: "scale", direction: "horizontal"}); }); </ Script> </ Body> </ Html>