Animated slector select any element that is currently animated:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="lib/jquery/jquery-1.3.2.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
function
anidiv(){
$("div:eq(0)").animate({
width: "50%"
},
"slow");
$("div:eq(0)").animate({
width: "100%"
},
"slow",
anidiv);
}
anidiv();
$(".btn1").click(function(){
$(":animated").css("background-color", "yellow");
});
});
</script>
</head>
<body>
<button class="btn1">
Change color of animated element
</button>
<div style="background:green;">
Div 1
</div>
<div style="background:blue;">
Div 2
</div>
<div style="background:red;">
Div 3
</div>
</body>
</html>
Comments
Post a Comment