javascript - Pop image out of div -
how pop image out of div , set width 100% (so takes of screen)? note: don't want use plugins.
i have far:
<div class="container"> <img src="thumbnail_image.png" /> </div>
jquery:
$(document).on("click", ".container img", function(event) { /* image name. */ var src = $(this).attr('src').split('/'); var file = src[src.length - 1]; /* load big image container replace thumbnail. */ $(this).attr('src', 'big_images/' + file); });
how this?
you can use css position fixed. defining class this:
.fullscreen_image { position: fixed; top: 0; left: 0 width: 100%; }
you can add , remove class image.
$(this).addclass( 'fullscreen_image' );
Comments
Post a Comment