animate用法介紹
$(selector).animate(properties, duration, easing, callback);
- properties(必填) {css樣式組}
- duration(可選) 持續時間
- easing(可選) 動畫加速方式
- callback(可選) function(){}
動態樣式支援類型
類型 | css |
---|---|
支援的屬性 | height、width、opacity、margin、padding、left、top、right、bottom、fontSize、borderWidth、scrollTop、scrollLeft |
不支援的屬性 | backgroundColor、color、borderColor、boxShadow、textShadow |
動態改變樣式
|
|
動態改變樣式(進階用法)
|
|
動態改變背景顏色
需要再額外引入jQuery.ui
|
|
|
|
|
|
延遲效果
|
|
show()若不給時間,會直接出現