Latest web development tutorials

jQuery UI API - size effects (Size Effect)

category

Special effects (Effects)

usage

Description: Adjust element size to the specified width and height.

size

参数 类型 描述 默认值
to Object 要调整到的高度和宽度。
origin Array 消失点。 [ "top", "left" ]
scale String 元素的哪个区域将被调整尺寸:"both"、"box"、"content"。当值为 "box" 时,调整元素的边框(border)和内边距(padding)的尺寸。当值为 "content" 时,调整元素内的所有内容的尺寸。 "both"

Examples

Use size effects (Size Effect) to adjust the size of the element.

<! Doctype html>
<Html lang = "en">
<Head>
  <Meta charset = "utf-8">
  <Title> size effects (Size 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 resized. </ P>
<Div id = "toggle"> </ div>
 
<Script>
$ (Document) .click (function () {
  $ ( "#toggle") .effect ( "Size", {
    to: {width: 200, height: 60}
  }, 1000);
});
</ Script>
 
</ Body>
</ Html>