PDA

View Full Version : pop up automatically resize image


stephanie
02-23-2004, 10:12 PM
hallo!!
recently I saw a website that pops up an enlarged image when the thumbnail is clicked. The image is automatically resized when the pop up window is resized.
Can anyone tell me how is it done?

http://www.equnxin.com
just click on the eng>product>new production
then any product would do and it has a link on click for larger image.

thanks!

Willy Duitt
02-23-2004, 10:39 PM
Like this. ;)
<script type="text/javascript">
function diy_popUp(target, width, height, style, wnd, otop, oleft){
if(!width) width=600;
if(!height) height=400;
if(!wnd) wnd="_blank";
if(!style) style="toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes";

if(typeof(otop) != "undefined") wtop=otop;
else {
wtop= (window.screen.availHeight - height - 120) / 2 ;
if(wtop>50) wtop-=40;
}
if(typeof(oleft) != "undefined") wleft=oleft;
else wleft= (window.screen.availWidth - width) / 2;

style +=",left="+wleft+",top="+wtop+",height="+height+",width="+width;
window.open(target,wnd,style);
}
</script>
</HEAD>

<BODY>
<a href="javascript:diy_popUp(document.all.diy_img_prod.src)"><img name="diy_img_prod" width="180" border="0" src="http://img.ebigchina.com/cdimg/149103/531892/0/1076664261.jpg"><br>click for larger photo</a>

.....Willy

stephanie
02-24-2004, 11:30 PM
hey thanks willy.
but it seems to have a bit problem on my side. there are error on page problem.

Willy Duitt
02-25-2004, 03:29 AM
I just checked and nothing was corrupted when the code was
posted to the forum. Did you try the code as is before
you began making any changes?

Can you post a link or provide an attachment so I
can see how the code was implemented into your page?

Also; the use of document.all is propreitary and will only
work with Internet Explorer. What browser are you using?
I assume IE since you provided the link.

.....Willy

stephanie
02-27-2004, 12:58 AM
Thank you very much!!!
I have a really silly mistake in my coding.
Anyway, thanks again...