Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery .each - get all objects in one element

0 votes
19 views
added Sep 5 in jQuery by LC Marshal Lieutenant (13,450 points)
edited Sep 5 by LC Marshal
//clone every image to popup element when click 
var floorplanImg = $('.detail-content.floorplan img'),
    imgModal = $('.global-overlay-modal');
$(floorplanImg).addClass('pop-floorplan');

$(floorplanImg).each(function(index) {
    $(this).on('click', function(){
        $(imgModal).fadeIn(300).addClass('active').show();
        var imgSingle = $(this).clone();
        $('.img-popup-detail').html(imgSingle); 
        // console.log($(this).attr('src'));
        if($(imgModal).hasClass('active')) {
            $(imgModal).click(function (){
                $(this).fadeOut(300); 
            });
        }
    });
});

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...