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

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -