PDA

Click to See Complete Forum and Search --> : Simple Image Gallery PopUp using Javascript



eastboy301
03-12-2007, 11:38 AM
I have an image gallery of thumbnails in an html page. I want it so that you can click on these thumbnails and it will open up the original bigger picture inside an HTML file in a new window using javascript coding.

I also need to make it so that each photo opens in a new window using the SAME html page. I think they are called URL variables or something of that sort. for instance if I have a picture with the filename pick001.jpg I want it so that when you click on its thumbnail it opens up in a URL like "photo.html?=pick001.jpg".

One more requirement is for each of the popups to open in the SAME window. I dont want multiple new windows opening each time the user clicks on a thumbnail.

Can anybody help me with this?

ihoss.com
03-13-2007, 07:24 PM
You ask for a lot ;)

popup-code-generator (http://javascript.internet.com/generators/popup-window.html)
This code will make you a popup. Remove the part setting the current time as id, and instead use your website name.

Put an <a> tag around each image and add an onclick event to them, like so:
<a href="pick001.jpg" target="the id value" onclick="popUp("photo.html?img="+this.href); return false;"><img ... /></a>

The reason there is an href and target part is so that it will still work even if your user doesn't have javascript. The onclick code will fire the popUp function which will show the image.

Hope this works :)