Line 193: | Line 193: | ||
// 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 = document.getElementById('myImg'); | var img = document.getElementById('myImg'); | ||
− | var modalImg = document.getElementById( | + | var modalImg = document.getElementById('img01'); |
− | var captionText = document.getElementById( | + | var captionText = document.getElementById('caption'); |
img.onclick = function(){ | img.onclick = function(){ | ||
modal.style.display = "block"; | modal.style.display = "block"; | ||
Line 202: | Line 202: | ||
// Get the <span> element that closes the modal | // Get the <span> element that closes the modal | ||
− | var span = document.getElementsByClass( | + | var span = document.getElementsByClass('close')[0]; |
// When the user clicks on <span> (x), close the modal | // When the user clicks on <span> (x), close the modal |
Revision as of 23:04, 18 October 2016
The Best
×