-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
39 lines (34 loc) · 1004 Bytes
/
scripts.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
window.onscroll = function () {
stickynavbar()
};
let navbar = document.getElementById("navbar");
let sticky = navbar.offsetTop;
function stickynavbar() {
if (window.screenY || document.documentElement.scrollTop >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}
function openModal(event) {
let modal = document.getElementById("myModal");
let images = document.getElementsByClassName("images");
let modalImg = document.getElementById("img01");
for (let i = 0; i < images.length; i++) {
let img = images[i];
img.onclick = function (evt) {
modal.style.display = "block";
modalImg.src = this.src;
}
}
}
function closeModal(event) {
const modal = document.getElementById("myModal");
modal.style.display = "none";
}
function darkmode() {
let element = document.body;
let button = document.getElementById("button")
element.classList.toggle("dark-mode");
button.classList.toggle("fa-flip-horizontal");
}