-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathscript.js
30 lines (23 loc) · 763 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"use strict";
const modal = document.getElementById("myModal");
//const modalDiv = document.getElementById
const img = document.getElementsByClassName("img-f");
const modalImg = document.getElementById("img01");
let i;
let imagesLength = img.length;
for (i = 0; i < imagesLength; i++) {
img[i].onclick = function() {
modal.style.display = "block";
modalImg.src = this.src;
document.querySelector("body").style.overflow = "hidden";
};
}
const span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
document.querySelector("body").style.overflow = "auto";
};
modal.ondblclick = function() {
modal.style.display = "none";
document.querySelector("body").style.overflow = "auto";
};