css - How can I display the image clicked on another div in jquery -
how can show image clicked on div has larger size display image?
i have tried many times , through many logics after hours of hardwork though post here. below code :
i need display clicked image in smaller slide large div display class named largerimage
.
$(document).ready(function(){ $("img").onclick(function() { $(".largerimage").show($this); }); });
i think do.
$("img").click(function(){ $img = $(this).clone(); $(".largerimage").show().html($img.removeattr('width')); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img width="100" src="http://dummyimage.com/300x200/000/fff"/> <div class="largerimage"></div>
Comments
Post a Comment