Last updated 20 days ago
四個參數。
$("div.div_block").animate({ "width": "200px", "height": "300px" }, 5000, "swing", function(){ // 動畫效果跑完後,執行這裡 });
第一個參數:帶入要操控的 CSS。
第二個參數:時間,單位是毫秒。
第三個參數,可以是 swing (預設)或 linear (從頭到尾等速)。
swing
linear
第四個參數:帶入匿名函式,動畫效果跑完後,執行匿名函式。
例:
1、先瞭解 .prop("scrollHeight"):
.prop("scrollHeight")
2、瞭解 animate 當中的 scrollTop:
3:建立 chat_interface.html 網頁檔
chat_interface.html
完成版: