jquery 动画实现循环执行
怎么实现如下动画无限执行呢,用回调函数不行,用setTimeout("sssss()",10)也不行 网上好多人说的方法实验了都没用
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function sssss(){
$(".dotA").animate({top:"100px"},500);
$(".dotB").animate({top:"200px"},500);
$(".dotA").animate({top:"0px"},500);
$(".dotB").animate({top:"0px"},500);
});
</script>
</head>
<body style="width:700">
<div class="dotA" style="position:absolute">a</div>
<div class="dotB" style="position:absolute">b</div>
</body>
</html>
------解决思路----------------------
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(function(){
setInterval("ab()",500);
})
function ab(){
$(".dotA").animate({top:"100px"},500);
$(".dotB").animate({top:"200px"},500);
$(".dotA").animate({top:"0px"},500);
$(".dotB").animate({top:"0px"},500);
}
</script>
</head>
<body style="width:700">
<div class="dotA" style="position:absolute">a</div>
<div class="dotB" style="position:absolute">b</div>
</body>
</html>