API jQuery UI - skala efek (Skala Effect)
kategori
pemakaian
Keterangan: Sesuai dengan elemen persentase skala.
scale
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
direction | String | 特效的方向。可能的值:"both"、"vertical" 或 "horizontal"。 | "both" |
origin | Array | 消失点。 | [ "middle", "center" ] |
percent | Number | 要缩放到的百分比。 | |
scale | String | 元素的哪个区域将被调整尺寸:"both"、"box"、"content"。当值为 "box" 时,调整元素的边框(border)和内边距(padding)的尺寸。当值为 "content" 时,调整元素内的所有内容的尺寸。 | "both" |
contoh
Contoh 1:Gunakan efek zoom (Skala Effect) beralih div.
<! DOCTYPE html> <Html lang = "en"> <Head> <Meta charset = "utf-8"> <Title> efek Zoom (Skala Effect) Demo </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Gaya> #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> </ Kepala> <Body> <P> Klik di mana saja untuk beralih. </ P> <Div id = "beralih"> </ div> <Script> $ (Dokumen) .Klik (function () { $ ( "#toggle") .toggle ( "Skala"); }); </ Script> </ Body> </ Html>Contoh 2:
Hanya menggunakan efek zoom (Skala Effect) dalam satu arah untuk beralih div.
<! DOCTYPE html> <Html lang = "en"> <Head> <Meta charset = "utf-8"> <Judul >> efek zoom (Skala Effect) Demo </ title> <Link rel = "stylesheet" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <Gaya> #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> </ Kepala> <Body> <P> Klik di mana saja untuk beralih. </ P> <Div id = "beralih"> </ div> <Script> $ (Dokumen) .Klik (function () { $ ( "#toggle") .toggle ({Effect: "skala", arah: "horisontal"}); }); </ Script> </ Body> </ Html>