on page load clone first image from collection of photos

Posted by user313378 on Stack Overflow See other posts from Stack Overflow or by user313378
Published on 2012-03-21T11:18:04Z Indexed on 2012/03/21 11:30 UTC
Read the original article Hit count: 125

Filed under:

On my page I'm getting collection of photos, and I store them as thumbs below showImage div which needs to be refreshed with cloned image onclick. Basically everything is ok except I need to populate this showImage div onpage load with first image, and then to use this onclick clone which already works.

<a href="/Property/GetImage/someIntId">
  <img id="someIntId" class="details" width="100" height="100" src="/Property/GetImage/7" alt="">
</a>

function onPopUp() {
        $(".details").click(function (event) {
            //clone the clicked image
            var clone = $(this).clone();
            clone.height("250px").width("280px");
            //place it in the placeholder
            $('div#showImage').html(clone);
        });
    }

© Stack Overflow or respective owner

Related posts about jQuery