jQuery UI API - ผลกระทบการปรับ (ชั่งผล)
หมวดหมู่
การใช้
คำอธิบาย: ในสอดคล้องกับองค์ประกอบที่ร้อยละขนาด
scale
参数 | 类型 | 描述 | 默认值 |
---|---|---|---|
direction | String | 特效的方向。可能的值:"both"、"vertical" 或 "horizontal"。 | "both" |
origin | Array | 消失点。 | [ "middle", "center" ] |
percent | Number | 要缩放到的百分比。 | |
scale | String | 元素的哪个区域将被调整尺寸:"both"、"box"、"content"。当值为 "box" 时,调整元素的边框(border)和内边距(padding)的尺寸。当值为 "content" 时,调整元素内的所有内容的尺寸。 | "both" |
ตัวอย่าง
ตัวอย่างที่ 1:ใช้ขยายผล (ชั่งผล) เปลี่ยน div
<! Doctype html> <html lang = "th"> <head> <Meta charset = "UTF-8"> <title> ผลกระทบซูม (ชั่งผล) สาธิต </ title> <link rel = "สไตล์ชีต" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <style> #toggle { ความกว้าง: 100px; ความสูง: 100px; พื้นหลัง: # 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 = "สลับ"> </ div> <script> $ (เอกสาร) จำนวนคลิก (ฟังก์ชั่น () { $ ( "#toggle") .toggle ( "ชั่ง"); }); </ script> </ body> </ html>ตัวอย่างที่ 2:
ใช้เฉพาะผลกระทบซูม (ชั่ง Effect) ในทิศทางเดียวเพื่อสลับ div
<! Doctype html> <html lang = "th"> <head> <Meta charset = "UTF-8"> <title >> ผลกระทบซูม (ชั่งผล) สาธิต </ title> <link rel = "สไตล์ชีต" href = "// code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <style> #toggle { ความกว้าง: 100px; ความสูง: 100px; พื้นหลัง: # 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 = "สลับ"> </ div> <script> $ (เอกสาร) จำนวนคลิก (ฟังก์ชั่น () { $ ( "#toggle") .toggle ({ผลกระทบ: "โย" ทิศทาง "แนวนอน"}); }); </ script> </ body> </ html>