-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
111 lines (92 loc) · 3.23 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const hBtn = document.getElementById("menubar");
const nav = document.getElementById("mobNav");
const mobNavLinks = document.querySelectorAll("#mobNav a");
function toggleMenu() {
// hBtn.classList.toggle("open");
nav.classList.toggle("open");
}
hBtn.addEventListener("click", toggleMenu);
//nav.addEventListener("click", toggleMenu);
for (let i = 0; i < mobNavLinks.length; i++) {
mobNavLinks[i].addEventListener("click", toggleMenu);
}
const workModal = document.querySelector(".work-modal");
function showWorkModal(workId) {
workModal.style.display = "block";
fillWorkModal(workId);
}
function closeWorkModal() {
workModal.style.display = "none";
}
window.onclick = function (event) {
if (event.target == workModal)
closeWorkModal();
}
function fillWorkModal(workId) {
let work = document.getElementById(workId);
workModal.querySelector("h2").innerHTML = work.querySelector("h2").innerHTML;
workModal.querySelector(".canopy").innerHTML = work.querySelector(".canopy").innerHTML;
workModal.querySelector("p").innerHTML = work.querySelector("p").innerHTML;
workModal.querySelector(".work-img").style.backgroundImage = window.getComputedStyle(work.querySelector(".work-img")).backgroundImage;
workModal.querySelector(".skills").innerHTML = work.querySelector(".skills").innerHTML;
}
/*
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// Get the modal
var modal1 = document.getElementById("myModal");
var modal2 = document.getElementById("myModal2");
var modal3 = document.getElementById("myModal3");
var modal4 = document.getElementById("myModal4");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
var btn2 = document.getElementById("myBtn2");
var btn3 = document.getElementById("myBtn3");
var btn4 = document.getElementById("myBtn4");
// Get the <span> element that closes the modal
var spanclose = document.getElementsByClassName("close")[0];
var spanclose2 = document.getElementsByClassName("close2")[0];
var spanclose3 = document.getElementsByClassName("close3")[0];
var spanclose4 = document.getElementsByClassName("close4")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal1.style.display = "block";
}
btn2.onclick = function() {
modal2.style.display = "block";
}
btn3.onclick = function() {
modal3.style.display = "block";
}
btn4.onclick = function() {
modal4.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
spanclose.onclick = function() {
modal1.style.display = "none";
}
spanclose2.onclick = function() {
modal2.style.display = "none";
}
spanclose3.onclick = function() {
modal3.style.display = "none";
}
spanclose4.onclick = function() {
modal4.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal1) {
modal.style.display = "none";
} else if (event.target == modal2) {
modal2.style.display = "none";
} else if (event.target == modal3) {
modal3.style.display = "none";
} else if (event.target == modal4) {
modal4.style.display = "none";
}
}
*/