Get image url?

Hi there,

I’m working on a project where I have a gallery of images. When the user clicks on one I want it to be displayed ontop of the current screen similar to lightbox.

So what I have done is put a div the size of the screen with an opacity of 60% and a z-index of 1001, display:none. When you click on an image this fades in.

Fine. Now I need to load the image into another div which is centered in the middle of the screen. The problem is that I’m not sure how to get the url for the selected image.


Then I need to put that somehow into the div content…

(‘#frame’).load(img with got url, function(){

Err… is that even possible, or is .get(url) purely for the page url? And either way, where is the url stored once it’s got? How do I use that information in a further function.

Thanks very much for your help,

Please read the documentation for the get method.

You will find that its purpose is for quite a different and more complex task (ajax communication) than you require.

The window.location object contains the page url in its href property.

Thanks for your reply.

I am not sure I have clearly explained what I am trying to do.

I am wondering if I can create content using jQuery.

I have a div in my HTML markup which is empty, and I want to use jQuery to add the line:
<img src=“…”> into the div.
So if I click on a thumbnail of an image, it’s url will be copied into the <img src> tag, and so displaying the image in the new div.

I hope that makes more sense.

Anyway, I thank you for you input, I shall continue my quest.