I want dynamically load a full screen image by clicking on it (normal size).
So I have
CSS
.full-image {
max-width: 100%;
max-height: 100%;
bottom: 0;
left: 0;
margin: auto;
overflow: auto;
position: fixed;
right: 0;
top: 0;
}
JS
$(document).ready(function() {
$('img').on("click", function() {
var img = $(this);
var myWindow = window.open("img.html");
var src = img.attr('src');
var document1 = myWindow.document;
$(myWindow.document).ready(function() {
alert();
$(myWindow.document).contents().find('#image').attr('src', src);
});
});
});
I tried this answered question`in each variant but the best result I achieve is in the pasted javascript code: new window is opened and only after pressing the alert, image is loaded ONLY in the new window.
I would the image loaded in the same window, but obv adding "_self" doesn't work.
The new html page is like this <img id = "image" class = "full-image"/>
Thanks.