<i class="fa fa-chevron-circle-left" aria-hidden="true"></i>
<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
<div id="myModal" class="modal">
<span class="close">×</span>
<img class="modal-content" id="img01">
</div>
<div class="gallery">
<img class="img" src="images/interior_1.jpg" alt="#">
<img class="img" src="images/interior_2.jpg" alt="#">
<img class="img" src="images/interior_3.jpg" alt="#">
<img class="img" src="images/interior_4.jpg" alt="#">
<img class="img" src="images/interior_5.jpg" alt="#">
</div>
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 5; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
}
.modal-content {
margin: auto;
display: block;
width: 80%;
max-width: 700px;
max-height: 500px;
}
.modal-content {
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.6 s;
animation-name: zoom;
animation-duration: 0.6 s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
.close {
position: absolute;
top: 15px;
right: 35px;
color: #f1f1f1;
font-size: 40px;
font-weight: bold;
transition: 0.3 s;
}
.close:hover,
.close:focus {
color: #bbb;
text-decoration: none;
cursor: pointer;
}
var modal = document.getElementById("myModal");
// Get the image and insert it inside the modal
var img = document.getElementsByClassName("img");
var modalImg = document.getElementById("img01");
img.onclick = function(){
modal.style.display = "block";
modalImg.src = this.src;
};
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x) close the modal
span.onclick = function() {
modal.style.display = "none";
};</span></span>
Find more questions by tags JavaScriptCSSLayout
IN the TAG
<script></code> BECAUSE IF you WRITE IN a SEPARATE FILE Ala script.js NEITHER MY SOLUTION NOR a SOLUTION to THIS KIND MAN FOR some REASON I doesn'T WORK (at least for me). Thank You again that helped)</script>
- Kelsie commented on June 10th 19 at 15:55In the case of a separate file, it comes not linear and must specify the date of its execution, for example
which means to carry current after loading the content - juana.Morar commented on June 10th 19 at 15:58