Line 5: | Line 5: | ||
<style> | <style> | ||
body {font-family: Arial, Helvetica, sans-serif;} | body {font-family: Arial, Helvetica, sans-serif;} | ||
− | + | ||
#PopupImg { | #PopupImg { | ||
border-radius: 45px; | border-radius: 45px; | ||
Line 11: | Line 11: | ||
transition: 0.3s; | transition: 0.3s; | ||
} | } | ||
− | + | ||
#PopupImg:hover {opacity: 0.7; z-index: -1;} | #PopupImg:hover {opacity: 0.7; z-index: -1;} | ||
− | + | ||
/* The Modal (background) */ | /* The Modal (background) */ | ||
.modal { | .modal { | ||
Line 28: | Line 28: | ||
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */ | background-color: rgba(0,0,0,0.9); /* Black w/ opacity */ | ||
} | } | ||
− | + | ||
/* Modal Content (image) */ | /* Modal Content (image) */ | ||
.modal-content { | .modal-content { | ||
Line 36: | Line 36: | ||
overflow-y: scroll; | overflow-y: scroll; | ||
} | } | ||
− | + | ||
/* Caption of Modal Image */ | /* Caption of Modal Image */ | ||
#caption { | #caption { | ||
Line 48: | Line 48: | ||
height: 150px; | height: 150px; | ||
} | } | ||
− | + | ||
/* Add Animation */ | /* Add Animation */ | ||
.modal-content, #caption { | .modal-content, #caption { | ||
Line 56: | Line 56: | ||
animation-duration: 0.6s; | animation-duration: 0.6s; | ||
} | } | ||
− | + | ||
@-webkit-keyframes zoom { | @-webkit-keyframes zoom { | ||
from {-webkit-transform:scale(0)} | from {-webkit-transform:scale(0)} | ||
to {-webkit-transform:scale(1)} | to {-webkit-transform:scale(1)} | ||
} | } | ||
− | + | ||
@keyframes zoom { | @keyframes zoom { | ||
from {transform:scale(0)} | from {transform:scale(0)} | ||
to {transform:scale(1)} | to {transform:scale(1)} | ||
} | } | ||
− | + | ||
/* The Close Button */ | /* The Close Button */ | ||
.close { | .close { | ||
Line 77: | Line 77: | ||
transition: 0.3s; | transition: 0.3s; | ||
} | } | ||
− | + | ||
.close:hover, | .close:hover, | ||
.close:focus { | .close:focus { | ||
Line 84: | Line 84: | ||
cursor: pointer; | cursor: pointer; | ||
} | } | ||
− | + | ||
/* 100% Image Width on Smaller Screens */ | /* 100% Image Width on Smaller Screens */ | ||
@media only screen and (max-width: 700px){ | @media only screen and (max-width: 700px){ | ||
Line 92: | Line 92: | ||
} | } | ||
− | h2 { | + | h2 { |
− | top: 250px; | + | position: relative; |
− | left: 0; | + | top: 250px; |
+ | left: 0; | ||
} | } | ||
− | + | ||
</style> | </style> | ||
</head> | </head> | ||
Line 156: | Line 157: | ||
</div> | </div> | ||
</div> | </div> | ||
− | + | ||
<div style="padding-top: 20px; float: bottom;"> | <div style="padding-top: 20px; float: bottom;"> | ||
<div class= 'oneThirdClass'> | <div class= 'oneThirdClass'> | ||
Line 198: | Line 199: | ||
<!--alert(target.src);--> | <!--alert(target.src);--> | ||
var modal = document.getElementById('PopupModal'); | var modal = document.getElementById('PopupModal'); | ||
− | + | ||
// Get the image and insert it inside the modal - use its "alt" text as a caption | // Get the image and insert it inside the modal - use its "alt" text as a caption | ||
var img = target.alt; | var img = target.alt; | ||
Line 205: | Line 206: | ||
modal.style.display = "inline"; | modal.style.display = "inline"; | ||
modalImg.src = target.src; | modalImg.src = target.src; | ||
− | + | ||
− | + | ||
captionText.innerHTML = target.alt; | captionText.innerHTML = target.alt; | ||
// Get the <span> element that closes the modal | // Get the <span> element that closes the modal | ||
var span = document.getElementsByClassName("close")[0]; | var span = document.getElementsByClassName("close")[0]; | ||
− | + | ||
// When the user clicks on <span> (x), close the modal | // When the user clicks on <span> (x), close the modal | ||
span.onclick = function() { | span.onclick = function() { |
Revision as of 00:25, 25 August 2018
×