动态选择器:animated Selector
描述:当选择器运行时,选择动态进程中的所有元素。(对动态进程起作用)
jQuery( ":animated" )
注释::animated是jquery的一个扩展
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>next siblings
demo</title>
<style>
div{
background:yellow;
border:1px solid #AAA;
width:80px;
height:80px;
margin:0 5px;
float:left;
}
div.colored{
background:green;
}
</style>
<script
src="js/jquery-1.9.1.min.js"></script>
</head>
<body>
<button id="run">Run</button>
<div></div>
<div id="mover"></div>
<div></div>
<script>
function animateIt(){
$("#mover").slideToggle("slow", animateIt);
}
$("#run").click(function(){
$("div:animated").toggleClass("colored");
});
animateIt();
</script>
</body>
</html>