1
Simple Machines Forum / Re: อยากลองทำตัวสั่นๆแบบนี้ต้องทำไงครับ
« เมื่อ: 13 มีนาคม 08, 22:33:41 »โค๊ด: [Select]
<script type="text/javascript">
if (typeof(wavyTextNo) == \'undefined\')shakeTextNo=0;
function shakeElementById(elmID,atk,amo,wait){
shakeTextNo++;var elm=document.getElementById(elmID);if(typeof(atk)==\'undefined\')var atk=5;if(typeof(amo)==\'undefined\')var amo=0.1;if(typeof(wait)==\'undefined\')var wait=1000;var cpos=atk;
var Shake=function(){cpos-=amo;if(cpos<0)cpos=0;
elm.style.position=\'relative\';
elm.style.top=(Math.round(Math.random()*2)==1?\'-\':\'\')+Math.round((Math.random()*cpos))+\'px\';
elm.style.left=(Math.round(Math.random()*2)==1?\'-\':\'\')+Math.round((Math.random()*cpos))+\'px\';
if(cpos>0){setTimeout(Shake, 5);}else{cpos=atk;setTimeout(Shake,wait);}};Shake();}
</script>