$(function () { setTimeout('rect()'); //アニメーションを実行 }); function rect() { $("#rect").animate({ opacity: ".3" }, 2000).animate({ opacity: "1" }, 2000); setTimeout("rect()", 4000); //アニメーションを繰り返す間隔 }
<div id="content"> <div id="rect">box</div> </div>
#rect { background:#87d3ff; width:100px; padding:10px; margin:100px auto 0; text-align:center; color:#fff; }