user686327
user686327

Reputation: 193

Clicking on a picture thumbnail and expanding to the center with javascript

I don't know the best way to ask this, but I will give it a try.

I have thumbnails of 3 photos corresponding to peoples bios. I am trying to have the thumbnails listed by the bios then give the user the ability to click a thumbnail and have the picture expand to the middle of the screen. When the user clicks off of the picture, the page returns to normal.

I am sure there is a term for this and I am sure it is an easy jQuery method, but I am having trouble locating the code to do so.

Thanks for any help!

Ryan

Upvotes: 1

Views: 3743

Answers (1)

Alex
Alex

Reputation: 9471

The term is a lightbox. There any many jQuery lightbox plugins. I've had great experience with FancyBox.

To use them, you could target all anchor tags which have direct children img tags, for instance:

$('a:has(img)').fancybox();

Upvotes: 2

Related Questions