# Make images clickable using javascript



## skyhigh007 (Jun 17, 2004)

Hi

I've just created an image gallery and each pictures are thumbnails. I want to display a bigger picture of that thumbnail when the user clicks on it. How do you do that with Javascript ? or are there any other ways?


----------



## MMJ (Oct 15, 2006)

Can you be more precise?


----------



## skyhigh007 (Jun 17, 2004)

Sorry, for not clearing it up. What I want to achieve is When someone clicks on the thumbnail, I want to display a bigger picture of that thumbnail within the same page and clicks on the bigger picture to go back to the image gallery. Do you really have to use Javascript? Can you just embedded onclick() to the img tag?


----------



## MMJ (Oct 15, 2006)

onclick is javascript.

Do you know javascript?

You'd have to do something like:

When the user clicks on the thumb create a new img element.
point the src to the bigger image.
make it position:absolute or fixed and give it a high z-index.
add some css style.

or else you'll have to look for a ready made script.


----------



## skyhigh007 (Jun 17, 2004)

I don't know Javascript and CSS only has hover, focus, and active. I can only come up with when someone rollover the thumbnail and displays a bigger image, but not click. How do you make it click using css ?


----------



## Sakusami (Dec 26, 2007)

This site can be very helpful for learning javascript and just as a javascript reference.

http://www.w3schools.com/js/default.asp


----------



## MMJ (Oct 15, 2006)

skyhigh007 said:


> I don't know Javascript and CSS only has hover, focus, and active. I can only come up with when someone rollover the thumbnail and displays a bigger image, but not click. How do you make it click using css ?


What do you mean?


----------



## skyhigh007 (Jun 17, 2004)

How do you display a bigger image of the thumbnail in the same page of the gallery when someone clicks on it using css ?


----------



## MMJ (Oct 15, 2006)

skyhigh007 said:


> How do you display a bigger image of the thumbnail in the same page of the gallery when someone clicks on it using css ?


Its not like there is a function or a css property to make a bigger image.

Do you want to display a bigger image of the thumbnail (I don't think you want this) or do you want to display the full sized image?


----------



## tomdkat (May 6, 2006)

skyhigh007, are you looking for a script to do something similar to this or this?

Peace...


----------



## skyhigh007 (Jun 17, 2004)

I got it done Thank you all. My other question is How do you make your website to FIT all the latest gadgets 
screen? ex: Iphone, PSP, etc.


----------



## MMJ (Oct 15, 2006)

Google "Accessibility".


----------

