.animate動畫

來源:互聯網
上載者:User

標籤:

.animate(params, [duration], [easing], [callback])

params: 結果樣式屬性

duration: 動畫時間長度 也可以用 slow normal fast

easing: 預設jQuery提供"linear" 和 "swing"

callback: 在動畫完成時執行的函數,直接寫function(){}

animate(params, options)

options:

{queue:預設true,}如果設定false則會跳出隊列,直接執行。

 例子:HTML 程式碼:
<button id="go1">» Animate Block1</button><button id="go2">» Animate Block2</button><div id="block1">Block1</div><div id="block2">Block2</div>

jQuery 代碼:

$("#go1").click(function(){  $("#block1").animate( { width: "90%"}, { queue: false, duration: 5000 } ) //脫離隊列,會和fontSize一起執行     .animate( { fontSize: ‘10em‘ } , 1000 )     .animate( { borderWidth: 5 }, 1000);});$("#go2").click(function(){  $("#block2").animate( { width: "90%"}, 1000 )     .animate( { fontSize: ‘10em‘ } , 1000 )     .animate( { borderWidth: 5 }, 1000);});

點擊按鈕1: 寬度和字型大小同時動畫,然後邊框寬再執行。

點擊按鈕2: 三個動畫按照順序逐一執行。

 

 

結果樣式參考:

 

styles

 

可能的 CSS 樣式值(提供執行個體):

  • backgroundPosition
  • borderWidth
  • borderBottomWidth
  • borderLeftWidth
  • borderRightWidth
  • borderTopWidth
  • borderSpacing
  • margin
  • marginBottom
  • marginLeft
  • marginRight
  • marginTop
  • outlineWidth
  • padding
  • paddingBottom
  • paddingLeft
  • paddingRight
  • paddingTop
  • height
  • width
  • maxHeight
  • maxWidth
  • minHeight
  • minWidth
  • font
  • fontSize
  • bottom
  • left
  • right
  • top
  • letterSpacing
  • wordSpacing
  • lineHeight
  • textIndent

注釋:CSS 樣式使用 DOM 名稱(比如 "fontSize")來設定,而非 CSS 名稱(比如 "font-size")。

.animate動畫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.