View Single Post
  #5  
Old 28-05-2010, 10:11 PM
multiweb's Avatar
multiweb (Marc)
ze frogginator

multiweb is offline
 
Join Date: Oct 2007
Location: Sydney
Posts: 22,080
Quote:
Originally Posted by bloodhound31 View Post
I have two photos almost identical, with a slight change in each that I want to animate. How do I do this?

Baz.
It it's reasonably small you can do an animated GIF file otherwise load 2 JPEGs and do a quick javascript rollover like so (very simplistic and you can use any size):

//*********************
// in page header
//*********************
<SCRIPT language=JavaScript>
<!--
function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.fra mes.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.le ngth;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//-->
</SCRIPT>

//*********************
// in your page body
//*********************

<img name="mypic" border="0" src="neutral.jpg" alt="mypic" onmouseover="MM_swapImage('mypic',' ','rollover.jpg',1);" onmouseout="MM_swapImgRestore();">

Last edited by multiweb; 28-05-2010 at 10:29 PM. Reason: Ooops! Forgot one
Reply With Quote