change A to img if u only want the image to move
- makes ur primary pic .. photo gallery... comment pic and friendlist shake
other version using math
Code:
- makes ur primary pic .. photo gallery... comment pic and friendlist shake
- Code:
/**********************************/
/* Submitted: by: Admer */
/**********************************/
function shake(){br=document.getElementsByTagName("A");
for(bage=0;bage<br.length;bage++){br[bage].style.position="relative";
br[bage].onmouseover=function(){shakeit(this);qkie();}
br[bage].onmouseout=function(){newPosition(this);top.focus();}}}
attachOnLoadHandler(shake);sa=0;pimp=1;
function shakeit(go){sa=0;my=go;
my.style.left=0;my.style.top=0;}function qkie(){if(sa==1){return;}
if(pimp==1){my.style.top=parseInt(my.style.top)+3;pimp++;}
else if(pimp==2){my.style.left=parseInt(my.style.left)+3;pimp++;}
else if(pimp==3){my.style.top=parseInt(my.style.top)-3;pimp++;}
else{my.style.left=parseInt(my.style.left)-3;pimp=1;}
setTimeout(qkie,50)}function newPosition(go){
sa=1;go.style.left=0;go.style.top=0;}
other version using math
Code:
- Code:
/**************************************************/
/* Image shake - Friendster Tweaks */
/* by: Archer - [You must be registered and logged in to see this link.] */
/* adjust the value of speed and radius */
/**************************************************/
pics = document.getElementsByTagName('img')
FF = "Netscape"
IE = "Microsoft Interner Explorer"
radius=8
speed=5
a = 0
function tagAllPics(){
for(x=0; x<pics.length;x++){
if(navigator.appName==FF){
pics[x].setAttribute("onmouseover","tagX("+x+")")
pics[x].setAttribute("onmouseout","tagY("+x+")")
}
else{
psrc = pics[x].getAttribute("src")
pid = pics[x].getAttribute("id")
pcls = pics[x].getAttribute("class")
pics[x].outerHTML=
"<img id="+pid+" class="+pcls+" src="+psrc+
" onmouseover=tagX("+x+") onmouseout=tagY("+x+")>"}
}
}
function tagX(x){
pics[x].style.position="relative"
moveIt = setInterval("orbit("+x+")",5)
}
function tagY(x){
pics[x].style.top = "0"
pics[x].style.left= "0"
window.clearInterval(moveIt)
}
function orbit(x){
pics[x].style.top= radius*Math.cos(a/speed)
pics[x].style.left=radius*Math.sin(a/speed)
a++;}
setTimeout("tagAllPics()", 1000)
Last edited by admer on 11/8/2009, 06:49; edited 1 time in total