Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

How to make an image appear beneath a slider on click?

I have a slider, this one specifically: http://codecanyon.net/item/jquery-carousel-evolution/490018. I want to make it so when the user clicks on an image, it opens beneath it on the same page (not a light box)

1 Answer

To achieve such a result I would simply catch the url of the clicked image in a variable, and then append that one where you want, to display the full image.

That could be something like that, here is a raw example :

$('.gallery img').click(function(){
   var url_img = $(this).attr('src');
    $('#append-here img').attr('src',url_img);

});

Check this fiddle

Thanks! That works!