欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中:animated選擇器用法實(shí)例

 更新時(shí)間:2014年12月29日 15:04:05   投稿:shichen2014  
這篇文章主要介紹了jQuery中:animated選擇器用法,實(shí)例分析了:animated選擇器的功能、定義及匹配動(dòng)畫效果元素的使用技巧,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jQuery中:animated選擇器用法。分享給大家供大家參考。具體分析如下:

此選擇器匹配所有正在執(zhí)行動(dòng)畫效果的元素。
可以使用animate()方法創(chuàng)建自定義動(dòng)畫。

語法結(jié)構(gòu):

復(fù)制代碼 代碼如下:
$(":animated")

此選擇器一般也要和其他選擇器配合使用,比如類選擇器和元素選擇器等等。例如:
復(fù)制代碼 代碼如下:
$("li:animated").css("background-color","blue")

以上代碼能夠?qū)⒄趫?zhí)行動(dòng)畫下過的li元素的背景顏色設(shè)置為藍(lán)色。
如果不和其他選擇器配合使用,則默認(rèn)狀態(tài)是和*選擇器配合使用,例如$(":animated")等同于$("*:animated")。

實(shí)例代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.dbjr.com.cn/" />
<title>腳本之家</title>
<style type="text/css">
li{
  list-style-type:none;
  width:150px;
  height:30px;
}
.run{background-color:green;}
.static{background-color:#603;}
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  function runit(){
    $(".run").animate({width:"250px"});
    $(".run").animate({width:"150px"},runit);
  }
  $("button").click(function(){
    runit();
    $("li:animated").css("background-color","blue");
  })
})
</script>
</head>
<body>
<ul>
  <li class="run"></li>
  <li class="static"></li>
</ul>
<button>點(diǎn)擊開始動(dòng)畫</button>
</body>
</html>

以上可以將動(dòng)畫元素的背景顏色設(shè)置為藍(lán)色。

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論