timer - clearTimeout setInterval not working. But does in other script? -
i wish animation loop on , on throughout page duration, reason cleartimer not fulfilling job. or have got looping wrong thinking clearing timers produce loop function granted.
<script> (function () { var a1; a1 = settimeout(anim1,9000); var a2; a2 = settimeout(anim2,10000); var a3; a3 = settimeout(anim3,11000); var a4; a4 = settimeout(anim4,12000); function anim1() { document.getelementbyid("tx1").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim2() { document.getelementbyid("tx2").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim3() { document.getelementbyid("tx3").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim4 () { cleartimeout(a1); cleartimeout(a2); cleartimeout(a3); cleartimeout(a4); } })(); </script>
i can see no problems, , same script runs in file...
i want animation loop on basically. runs once, dies, assume cleartimeout not problem. ???
found workaround allthough im still not sure if im clearing timers correctly. done job must ok now... folks...
heres script..
<script> window.onload=function start() { var a1 = settimeout(anim1,9000); var a2 = settimeout(anim2,10000); var a3 = settimeout(anim3,11000); var a4 = settimeout(anim4,12000); function anim1() { document.getelementbyid("tx1").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim2() { document.getelementbyid("tx2").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim3() { document.getelementbyid("tx3").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim4() { cleartimeout("a3") cleartimeout("a1"); cleartimeout("a2"); cleartimeout("a4"); start(); } } </script>
Comments
Post a Comment