Hey guys! I'm trying to make it so that when someone clicks on a picture, the picture shows up as a sort of pop-up thing in a new div and they can get out of it by clicking outside of the div. Here's my code so far:
Code:
$('document').ready(function () {

        $('.images-container a img').click(function(){
            var src = $(this).attr('src');
            var newdiv = $('<div class="pop-up"> <img src="' + src + '"</div>');
            $('body').addClass('opacity');
            $('body').append(newdiv);
        });

    $('body').click(function(){
        $('.lightbox').remove();
        $('body').removeClass('opacity');
    });
});
Could i get some advice please?