PDA

View Full Version : Picture in new popup window



LilDenyo
11-01-2005, 07:02 PM
How can I handle, if i got an image on my site, i click on it and the big picture will open in a new popup window (Not bigger as the picture) that there is no white border. Just the fullsize Picture in this popup...

jscheuer1
11-02-2005, 04:36 AM
This is actually a bit more complicated than it might appear and you may want further refinements once you get what you are asking for and see how it looks/works. Here is a basic interpretation of what you are asking for -

In the head of the page, put this script:


<script type="text/javascript">
function openWin(image, w, h){
var wh='width='+w+',height='+h
var tmpPage=window.open('','',wh)
tmpPage.document.write('<body style="margin:0;padding:0;"><img src="'+image+'" width="'+w+'" height="'+h+'">')
tmpPage.document.close()
}
</script>

Where you want to click on an image and have the big picture pop up, use this kind of markup in the body of the page:


<a href="photo1.jpg" target="_blank" onclick="openWin(this.href, 140, 225);return false;"><img src="thumb1.jpg" width="50 height="50" border="0"></a>

photo1.jpg is the name (include the path if different than the page this is on) of the big picture. The two red numbers are the width and height (in that order) of the big picture. The img tag is just an ordinary image tag for the thumbnail (smaller image on the page that you click to get the pop up). You can use this type of markup as many times on the page as you want.

LilDenyo
11-02-2005, 05:02 PM
Thank you I will try it!!!!

LilDenyo
11-03-2005, 11:10 AM
I tried the code, thank you it works!!!