Log in

View Full Version : Look for script on mouse over image gets bigger



mikster
07-30-2011, 03:54 AM
Hi,

Can someone tell me how they are doing this on this page http://imgur.com/gallery/ffs1v where the image is rescaled to fit the layout and once I click it the large full scale picture pop up. Please point me in the right direction or suggest a script that does the same. Thanks in advance.

vwphillips
07-30-2011, 11:15 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
// Animate (24-June-2011)
// by Vic Phillips http://www.vicsjavascripts.org.uk

// To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
// With the ability to scale the effect time on specified minimum/maximum values
// and with three types of progression 'sin' and 'cos' and liner.

// The functional code size is 1.39K

// **** Application Notes

// **** The HTML Code
//
// when moving an element the inline or class rule style position of the element should be assigned as
// 'position:relative;' or 'position:absolute;'
//
// The element would normally be assigned a unique ID name.
//

// **** Initialising the Script.
//
// The script is initialised by assigning an instance of the script to a variable.
// e.g A = new zxcAnimate('left','id1')
// where:
// A = a global variable (variable)
// parameter 0 = the mode(see Note 1). (string)
// parameter 1 = the unique ID name or element object. (string or element object)
// parameter 2 = the initial value. (digits, default = 0)

// **** Executing the Effect
//
// The effect is executed by an event call to function 'A.animate(10,800 ,5000,[10,800]);'
// where:
// A = the global referencing the script instance. (variable)
// parameter 0 = the start value. (digits, for opacity minimum 0, maximum 100)
// parameter 1 = the finish value. (digits, for opacity minimum 0, maximum 100)
// parameter 2 = period of time between the start and finish of the effect in milliseconds. (digits or defaults to previous or 0(on first call) milliSeconds)
// parameter 3 = (optional) to scale the effect time on a specified minimum/maximum. (array, see Note 3)
// field 0 the minimum value. (digits)
// field 1 the maximum value. (digits)
// parameter 3 = (optional) the type of progression, 'sin', 'cos' or 'liner'. (string, default = 'liner')
// 'sin' progression starts fast and ends slow.
// 'cos' progression starts slow and ends fast.
//
// Note 1: Examples modes: 'left', 'top', 'width', 'height', 'opacity.
// Note 2: The default units(excepting opacity) are 'px'.
// For hyphenated modes, the first character after the hyphen must be upper case, all others lower case.
// Note 3: The scale is of particular use when re-calling the effect
// in mid progression to retain an constant rate of progression.
// Note 4: The current effect value is recorded in A.data[0].
// Note 5: A function may be called on completion of the effect by assigning the function
// to the animator intance property .Complete.
// e.g. [instance].Complete=function(){ alert(this.data[0]); };
//



// **** Functional Code - NO NEED to Change

function zxcAnimate(mde,obj,srt){
this.to=null;
this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
this.mde=mde.replace(/\W/g,'');
this.data=[srt||0];
return this;
}

zxcAnimate.prototype={

animate:function(srt,fin,ms,scale,c){
clearTimeout(this.to);
this.time=ms||this.time||0;
this.data=[srt,srt,fin];
this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
this.inc=Math.PI/(2*this.mS);
this.srttime=new Date().getTime();
this.cng();
},

cng:function(){
var oop=this,ms=new Date().getTime()-this.srttime,s=this.data[1],f=this.data[2],d=Math.floor(this.c=='s'?(f-s)*Math.sin(this.inc*ms)+s:this.c=='c'?f-(f-s)*Math.cos(this.inc*ms):(f-s)/this.mS*ms+s);
d=Math.max(d,s<0||f<0?d:0);
this.data[0]=d;
this.apply();
if (ms<this.mS){
this.to=setTimeout(function(){oop.cng(); },10);
}
else {
this.data[0]=this.data[2];
this.apply();
if (this.Complete) this.Complete(this);
}
},

apply:function(){
if (isFinite(this.data[0])){
if (this.mde!='opacity') this.obj.style[this.mde]=this.data[0]+'px';
else zxcOpacity(this.obj,this.data[0]);
}
}

}

function zxcOpacity(obj,opc){
obj.style.filter='alpha(opacity='+opc+')';
obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
}

</script>

</head>

<body>
<img id="tst1" src="http://i.imgur.com/ffs1v.jpg" alt="img" width="250" onmouseup="Magnify(this);" />
<img id="tst2" src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="img" width="250" onmouseup="Magnify(this,4,500,'http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg');" />

<script type="text/javascript">
/*<![CDATA[*/
// Magnify(this,4,500,'http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg');"
// where
// parameter 0 = the image object(the image object must be assigned a unique ID name). (object)
// parameter 1 = (optional) the magnification. (number, default = 3)
// parameter 2 = (optional) the effect duration in milli seconds. (number, default = 1000)
// parameter 3 = (optional) the src of the magnified image. (string, default = the image object src)

function Magnify(obj,mag,ms,src){
var oop,z0=0;
if (!Magnify.ary){
Magnify.ary=[];
Magnify.oops=[];
}
if (!Magnify.ary[obj.id]){
oop=new magnify(obj,mag,ms,src);
Magnify.ary[obj.id]=oop;
Magnify.oops.push(oop);
}
for (;z0<Magnify.oops.length;z0++){
Magnify.oops[z0].animate(Magnify.oops[z0]==Magnify.ary[obj.id]?true:false);
}

}

function magnify(obj,mag,ms,src){
mag=typeof(mag)=='number'?mag:3;
this.ms=typeof(ms)=='number'?ms:1000;
this.obj=obj;
this.wmm=[obj.width,obj.width*mag];
this.hmm=[obj.height,obj.height*mag];
var oop=this,img=document.createElement('IMG');
img.src=typeof(src)=='string'?src:obj.src;
img.style.position='absolute';
img.style.visibility='hidden';
img.style.zIndex='101';
document.body.appendChild(img);
this.lft=new zxcAnimate('left',img);
this.top=new zxcAnimate('top',img);
this.wid=new zxcAnimate('width',img);
this.wid.Complete=function(){
if (this.data[0]==oop.wmm[0]){
this.obj.style.visibility='hidden';
}
}
this.hei=new zxcAnimate('height',img);
img.onmouseup=function(){ oop.animate(false); }
}


magnify.prototype={

animate:function(ud){
var pos=this.pos(this.obj),wwhs=this.wwhs();
if (ud){
this.lft.obj.style.visibility='visible';
}
this.lft.obj.style.zIndex=ud?'101':'100';
this.lft.animate(ud?pos[0]:this.lft.data[0],ud?(wwhs[0]-this.wmm[1])/2+wwhs[2]:pos[0],this.ms);
this.top.animate(ud?pos[1]:this.top.data[0],ud?(wwhs[1]-this.hmm[1])/2+wwhs[2]:pos[1],this.ms);
this.wid.animate(this.wid.data[0],this.wmm[ud?1:0],this.ms);
this.hei.animate(this.hei.data[0],this.hmm[ud?1:0],this.ms);
this.wid.animate(this.wmm[ud?0:1],this.wmm[ud?1:0],this.ms);
this.hei.animate(this.hmm[ud?0:1],this.hmm[ud?1:0],this.ms);
},

pos:function(obj){
var rtn=[0,0];
while(obj){
rtn[0]+=obj.offsetLeft;
rtn[1]+=obj.offsetTop;
obj=obj.offsetParent;
}
return rtn;
},

wwhs:function(){
if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}

}

/*]]>*/
</script>

</body>

</html>

vwphillips
07-30-2011, 01:51 PM
or


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
// Animate (24-June-2011)
// by Vic Phillips http://www.vicsjavascripts.org.uk

// To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
// With the ability to scale the effect time on specified minimum/maximum values
// and with three types of progression 'sin' and 'cos' and liner.

// The functional code size is 1.39K

// **** Application Notes

// **** The HTML Code
//
// when moving an element the inline or class rule style position of the element should be assigned as
// 'position:relative;' or 'position:absolute;'
//
// The element would normally be assigned a unique ID name.
//

// **** Initialising the Script.
//
// The script is initialised by assigning an instance of the script to a variable.
// e.g A = new zxcAnimate('left','id1')
// where:
// A = a global variable (variable)
// parameter 0 = the mode(see Note 1). (string)
// parameter 1 = the unique ID name or element object. (string or element object)
// parameter 2 = the initial value. (digits, default = 0)

// **** Executing the Effect
//
// The effect is executed by an event call to function 'A.animate(10,800 ,5000,[10,800]);'
// where:
// A = the global referencing the script instance. (variable)
// parameter 0 = the start value. (digits, for opacity minimum 0, maximum 100)
// parameter 1 = the finish value. (digits, for opacity minimum 0, maximum 100)
// parameter 2 = period of time between the start and finish of the effect in milliseconds. (digits or defaults to previous or 0(on first call) milliSeconds)
// parameter 3 = (optional) to scale the effect time on a specified minimum/maximum. (array, see Note 3)
// field 0 the minimum value. (digits)
// field 1 the maximum value. (digits)
// parameter 3 = (optional) the type of progression, 'sin', 'cos' or 'liner'. (string, default = 'liner')
// 'sin' progression starts fast and ends slow.
// 'cos' progression starts slow and ends fast.
//
// Note 1: Examples modes: 'left', 'top', 'width', 'height', 'opacity.
// Note 2: The default units(excepting opacity) are 'px'.
// For hyphenated modes, the first character after the hyphen must be upper case, all others lower case.
// Note 3: The scale is of particular use when re-calling the effect
// in mid progression to retain an constant rate of progression.
// Note 4: The current effect value is recorded in A.data[0].
// Note 5: A function may be called on completion of the effect by assigning the function
// to the animator intance property .Complete.
// e.g. [instance].Complete=function(){ alert(this.data[0]); };
//



// **** Functional Code - NO NEED to Change

function zxcAnimate(mde,obj,srt){
this.to=null;
this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
this.mde=mde.replace(/\W/g,'');
this.data=[srt||0];
return this;
}

zxcAnimate.prototype={

animate:function(srt,fin,ms,scale,c){
clearTimeout(this.to);
this.time=ms||this.time||0;
this.data=[srt,srt,fin];
this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
this.inc=Math.PI/(2*this.mS);
this.srttime=new Date().getTime();
this.cng();
},

cng:function(){
var oop=this,ms=new Date().getTime()-this.srttime,s=this.data[1],f=this.data[2],d=Math.floor(this.c=='s'?(f-s)*Math.sin(this.inc*ms)+s:this.c=='c'?f-(f-s)*Math.cos(this.inc*ms):(f-s)/this.mS*ms+s);
d=Math.max(d,s<0||f<0?d:0);
this.data[0]=d;
this.apply();
if (ms<this.mS){
this.to=setTimeout(function(){oop.cng(); },10);
}
else {
this.data[0]=this.data[2];
this.apply();
if (this.Complete) this.Complete(this);
}
},

apply:function(){
if (isFinite(this.data[0])){
if (this.mde!='opacity') this.obj.style[this.mde]=this.data[0]+'px';
else zxcOpacity(this.obj,this.data[0]);
}
}

}

function zxcOpacity(obj,opc){
obj.style.filter='alpha(opacity='+opc+')';
obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
}

</script>

</head>

<body>
<img src="http://i.imgur.com/ffs1v.jpg" alt="img" width="250" class="zxcMagnify" />
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" class="zxcMagnify magnify:4 duration:500 src:http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" width="250" />


<script type="text/javascript">
/*<![CDATA[*/
// Magnify (30-July-2011)
// by Vic Phillips http://www.vicsjavascripts.org.uk

// <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" class="zxcMagnify magnify:4 duration:500 src:http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" width="250" /> onmouseup="Magnify(this,4,500,'http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg');"
// where
// magnify:2 = (optional) the magnification. (number, default = 3)
// duration:500 = (optional) the effect duration in milli seconds. (number, default = 1000)
// src:Egypt5 = (optional) the file path and name of the magnified image. (string, default = the image object src)

function zxcMagnify(cls){
cls=typeof(cls)=='string'?cls:'zxcMagnify';
zxcMagnify.ary=[];
zxcMagnify.bycls=function(){
for (var reg=new RegExp('\\b'+cls+'\\b'),els=document.getElementsByTagName('*'),ary=[],z0=0; z0<els.length;z0++){
if(reg.test(els[z0].className)){
ary.push(els[z0]);
}
}
return ary;
}
var ary=zxcMagnify.bycls(cls),oops=[],obj,index,oop,z0=0,z0a;
for (var z0=0;z0<ary.length;z0++){
obj={obj:ary[z0]};
cls=ary[z0].className.split(' ');
for (z0a=0;z0a<cls.length;z0a++){
index=cls[z0a].indexOf(':');
if (index>2){
obj[cls[z0a].substring(0,index).toLowerCase()]=cls[z0a].substring(index+1);
}
oop=new zxcmagnify(obj);
zxcMagnify.ary.push(oop);
oops.push(oop);
}
}
zxcMagnify.lst=function(oop){
for (var z0=0;z0<oops.length;z0++){
oops[z0].animate(oops[z0]==oop?true:false);
}
}
}

function zxcmagnify(o){
var oop=this,img=document.createElement('IMG'),mag=o.magnify,ms=o.duration,sec=o.src;
mag=isFinite(mag)?mag*1:3;
this.ms=isFinite(ms)?ms*1:1000;
this.obj=o.obj;
this.wmm=[o.obj.width,o.obj.width*mag];
this.hmm=[o.obj.height,o.obj.height*mag];
img.src=typeof(src)=='string'?src:o.obj.src;
img.style.position='absolute';
img.style.visibility='hidden';
img.style.zIndex='101';
document.body.appendChild(img);
this.lft=new zxcAnimate('left',img);
this.top=new zxcAnimate('top',img);
this.wid=new zxcAnimate('width',img);
this.wid.Complete=function(){
if (this.data[0]==oop.wmm[0]){
this.obj.style.visibility='hidden';
}
}
this.hei=new zxcAnimate('height',img);
o.obj.onmouseup=function(){ zxcMagnify.lst(oop); }
img.onmouseup=function(){ oop.animate(false); }
}

zxcmagnify.prototype={

animate:function(ud){
var pos=this.pos(this.obj),wwhs=this.wwhs();
if (ud){
this.lft.obj.style.visibility='visible';
}
this.lft.obj.style.zIndex=ud?'101':'100';
this.lft.animate(ud?pos[0]:this.lft.data[0],ud?(wwhs[0]-this.wmm[1])/2+wwhs[2]:pos[0],this.ms);
this.top.animate(ud?pos[1]:this.top.data[0],ud?(wwhs[1]-this.hmm[1])/2+wwhs[2]:pos[1],this.ms);
this.wid.animate(this.wid.data[0],this.wmm[ud?1:0],this.ms);
this.hei.animate(this.hei.data[0],this.hmm[ud?1:0],this.ms);
this.wid.animate(this.wmm[ud?0:1],this.wmm[ud?1:0],this.ms);
this.hei.animate(this.hmm[ud?0:1],this.hmm[ud?1:0],this.ms);
},

pos:function(obj){
var rtn=[0,0];
while(obj){
rtn[0]+=obj.offsetLeft;
rtn[1]+=obj.offsetTop;
obj=obj.offsetParent;
}
return rtn;
},

wwhs:function(){
if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}

}

zxcMagnify('zxcMagnify'); // parameter 0 = the common class nameof the images to expand. (default = 'zxcMagnify' )
/*]]>*/
</script>

</body>

</html>

mikster
08-18-2011, 11:10 PM
Wow thanks alot just what I need. I'm not that good with javascript but I managed to integrate the code into my site to get it functioning properly. The only thing I couldn't figure out is where in the code do I modify to set the magnification level. Basically I have 2 copies of every image I upload. 1 copy is the small version and the other one is the bigger version. The code that you pasted has a default width set to 250px whereas my default width on my site is 620. So what happens is that when i change 250 to 620 and click on it to magnify the pic....the magnification becomes super super big. Do you know where in the code I can modify to downsize the magnification?

Thanks again.

vwphillips
08-19-2011, 07:36 AM
use this latest issue code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
// Animate (24-June-2011)
// by Vic Phillips http://www.vicsjavascripts.org.uk

// To progressively change the Left, Top, Width, Height or Opacity of an element over a specified period of time.
// With the ability to scale the effect time on specified minimum/maximum values
// and with three types of progression 'sin' and 'cos' and liner.

// The functional code size is 1.39K

// **** Application Notes

// **** The HTML Code
//
// when moving an element the inline or class rule style position of the element should be assigned as
// 'position:relative;' or 'position:absolute;'
//
// The element would normally be assigned a unique ID name.
//

// **** Initialising the Script.
//
// The script is initialised by assigning an instance of the script to a variable.
// e.g A = new zxcAnimate('left','id1')
// where:
// A = a global variable (variable)
// parameter 0 = the mode(see Note 1). (string)
// parameter 1 = the unique ID name or element object. (string or element object)
// parameter 2 = the initial value. (digits, default = 0)

// **** Executing the Effect
//
// The effect is executed by an event call to function 'A.animate(10,800 ,5000,[10,800]);'
// where:
// A = the global referencing the script instance. (variable)
// parameter 0 = the start value. (digits, for opacity minimum 0, maximum 100)
// parameter 1 = the finish value. (digits, for opacity minimum 0, maximum 100)
// parameter 2 = period of time between the start and finish of the effect in milliseconds. (digits or defaults to previous or 0(on first call) milliSeconds)
// parameter 3 = (optional) to scale the effect time on a specified minimum/maximum. (array, see Note 3)
// field 0 the minimum value. (digits)
// field 1 the maximum value. (digits)
// parameter 3 = (optional) the type of progression, 'sin', 'cos' or 'liner'. (string, default = 'liner')
// 'sin' progression starts fast and ends slow.
// 'cos' progression starts slow and ends fast.
//
// Note 1: Examples modes: 'left', 'top', 'width', 'height', 'opacity.
// Note 2: The default units(excepting opacity) are 'px'.
// For hyphenated modes, the first character after the hyphen must be upper case, all others lower case.
// Note 3: The scale is of particular use when re-calling the effect
// in mid progression to retain an constant rate of progression.
// Note 4: The current effect value is recorded in A.data[0].
// Note 5: A function may be called on completion of the effect by assigning the function
// to the animator intance property .Complete.
// e.g. [instance].Complete=function(){ alert(this.data[0]); };
//



// **** Functional Code - NO NEED to Change

function zxcAnimate(mde,obj,srt){
this.to=null;
this.obj=typeof(obj)=='object'?obj:document.getElementById(obj);
this.mde=mde.replace(/\W/g,'');
this.data=[srt||0];
return this;
}

zxcAnimate.prototype={

animate:function(srt,fin,ms,scale,c){
clearTimeout(this.to);
this.time=ms||this.time||0;
this.data=[srt,srt,fin];
this.mS=this.time*(!scale?1:Math.abs((fin-srt)/(scale[1]-scale[0])));
this.c=typeof(c)=='string'?c.charAt(0).toLowerCase():this.c?this.c:'';
this.inc=Math.PI/(2*this.mS);
this.srttime=new Date().getTime();
this.cng();
},

cng:function(){
var oop=this,ms=new Date().getTime()-this.srttime,s=this.data[1],f=this.data[2],d=Math.floor(this.c=='s'?(f-s)*Math.sin(this.inc*ms)+s:this.c=='c'?f-(f-s)*Math.cos(this.inc*ms):(f-s)/this.mS*ms+s);
d=Math.max(d,s<0||f<0?d:0);
this.data[0]=d;
this.apply();
if (ms<this.mS){
this.to=setTimeout(function(){oop.cng(); },10);
}
else {
this.data[0]=this.data[2];
this.apply();
if (this.Complete) this.Complete(this);
}
},

apply:function(){
if (isFinite(this.data[0])){
if (this.mde!='opacity') this.obj.style[this.mde]=this.data[0]+'px';
else zxcOpacity(this.obj,this.data[0]);
}
}

}

function zxcOpacity(obj,opc){
obj.style.filter='alpha(opacity='+opc+')';
obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
}

</script>

</head>

<body>
<img src="http://i.imgur.com/ffs1v.jpg" alt="img" width="250" class="zxcMagnify" />
<img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" class="zxcMagnify magnify:4 duration:500 src:http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" width="250" />


<script type="text/javascript">
/*<![CDATA[*/
// Magnify (30-July-2011)
// by Vic Phillips http://www.vicsjavascripts.org.uk

// <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" class="zxcMagnify magnify:4 duration:500 src:http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" width="250" /> onmouseup="Magnify(this,4,500,'http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg');"
// where
// magnify:2 = (optional) the magnification. (number, default = 3)
// duration:500 = (optional) the effect duration in milli seconds. (number, default = 1000)
// src:Egypt5 = (optional) the file path and name of the magnified image. (string, default = the image object src)

function zxcMagnify(cls){
var ary=[],reg=new RegExp('\\b'+cls+'\\b'),els=document.getElementsByTagName('*'),oops=[],obj,index,oop,z0=0,z1=0,z1a;
cls=typeof(cls)=='string'?cls:'zxcMagnify';
for (;z0<els.length;z0++){
if(reg.test(els[z0].className)){
ary.push(els[z0]);
}
}
zxcMagnify.ary=[];
for (;z1<ary.length;z1++){
obj={obj:ary[z1]};
cls=ary[z1].className.split(' ');
for (z1a=0;z1a<cls.length;z1a++){
index=cls[z1a].indexOf(':');
if (index>2){
obj[cls[z1a].substring(0,index).toLowerCase()]=cls[z1a].substring(index+1);
}
}
oop=new zxcmagnify(obj);
zxcMagnify.ary.push(oop);
oops.push(oop);
}
zxcMagnify.lst=function(oop){
for (var z0=0;z0<oops.length;z0++){
oops[z0].animate(oops[z0]==oop?true:false);
}
}
}

function zxcmagnify(o){
var oop=this,img=document.createElement('IMG'),p=o.obj.parentNode,mag=o.magnify,ms=o.duration,sec=o.src;
mag=typeof(mag)=='number'?mag*1:3;
this.ms=isFinite(ms)?ms*1:1000;
this.obj=o.obj;
if (p.href){
p.removeAttribute('href');
}
this.wm=o.obj.width*mag;
this.hm=o.obj.height*mag;
img.src=typeof(src)=='string'?src:o.obj.src;
img.style.position='absolute';
img.style.visibility='hidden';
img.style.zIndex='101';
document.body.appendChild(img);
this.lft=new zxcAnimate('left',img);
this.top=new zxcAnimate('top',img);
this.wid=new zxcAnimate('width',img);
this.wid.Complete=function(){
if (this.data[0]!=oop.wm){
this.obj.style.visibility='hidden';
}
}
this.hei=new zxcAnimate('height',img);
o.obj.onmouseup=function(){ zxcMagnify.lst(oop); }
img.onmouseup=function(){ oop.animate(false); }
}

zxcmagnify.prototype={

animate:function(ud){
var pos=this.pos(this.obj),wwhs=this.wwhs(),obj=this.obj,w=obj.width,h=obj.height;
if (ud){
this.lft.obj.style.visibility='visible';
}
this.lft.obj.style.zIndex=ud?'101':'100';
this.lft.animate(ud?pos[0]:this.lft.data[0],ud?(wwhs[0]-this.wm)/2+wwhs[2]:pos[0],this.ms);
this.top.animate(ud?pos[1]:this.top.data[0],ud?(wwhs[1]-this.hm)/2+wwhs[2]:pos[1],this.ms);
this.wid.animate(ud?w:this.wm,ud?this.wm:w,this.ms);
this.hei.animate(ud?h:this.hm,ud?this.hm:h,this.ms);
},

pos:function(obj){
var rtn=[0,0];
while(obj){
rtn[0]+=obj.offsetLeft;
rtn[1]+=obj.offsetTop;
obj=obj.offsetParent;
}
return rtn;
},

wwhs:function(){
if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}

}

zxcMagnify('zxcMagnify'); // parameter 0 = the common class nameof the images to expand. (default = 'zxcMagnify' )
/*]]>*/
</script>

</body>

</html>

the magnifycation can be set in the image class name
or by modificating the default of 3 in the line I have marked in red