I'm trying to add the full size image when clicking on the thumbnail.
When I change the class to .thumbnail
in the second click function it successfully removes the thumbnail.
I've tried adding the image with the class .thumbnail
instead of .stretch
which did work but they didn't disappear after clicking on them again.
This code adds the picture but doesn't remove it when clicking on the picture again.
$('.thumbnail').click(function(){
$('<img class="stretch" src="_DSC1671.jpg">').insertAfter('.header');
});
$('.stretch').click(function(){
$(this).remove();
});
This code removes the thumbnail pictures successfully.
$('.thumbnail').click(function(){
$(this).remove();
});
This code adds the picture with the same attributes as the original thumbnails, removes the original thumbnails when clicked on them but doesn't remove the added thumbnails.
$('.thumbnail').click(function(){
$('<img class="stretch" src="_DSC1671.jpg">').insertAfter('.header');
});
$('.thumbnail').click(function(){
$(this).remove();
});
So I'm not sure what I'm doing wrong here. Apparently it has to do with the fact that the images are added in retrospective.
Thank you in advance for any assistance.