<!DOCTYPE html>
<html lang=‘zh-cn‘>
<head>
<title>Insert you title</title>
<meta http-equiv=‘description‘ content=‘this is my page‘>
<meta http-equiv=‘keywords‘ content=‘keyword1,keyword2,keyword3‘>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type=‘text/javascript‘ src=‘./js/jquery-3.0.0.js‘></script>
<style type=‘text/css‘>
div {
width: 100px; height: 100px; background: red; position: absolute;
}
#animat+div {
top: 150px;
}
.focused {
font: 400 13px/100px ‘Courier New‘; color: #FFF; text-align: center;
}
</style>
<script type=‘text/javascript‘>
$(function(){
setInterval(animat,1000);
function animat(){
$(‘#animat‘).animate({‘left‘: 500}, 1000,function(){
if($(this).get(0).offsetLeft >=500)
$(this).get(0).style.left = ‘9px‘;
});
}
animat(); //只有通过jQuery中"animat"动画函数执行的才有效果
$("div:animated").addClass(‘focused‘);
});
</script>
</head>
<body>
<div id=‘animat‘>animat</div>
<div id=‘no-animat‘>no-animat</div>
</body>
</html>
[ jquery选择器 :animated ] 此选择器匹配所有正在执行动画效果的元素
原文:http://www.cnblogs.com/mysearchblog/p/5605221.html