-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (28 loc) · 1.35 KB
/
index.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
var navbar_brand_img = document.querySelector(".navbar-brand img");
var navbar_brand = document.querySelector(".navbar-brand");
var navbar = document.querySelector(".navbar");
window.onscroll = function() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
navbar_brand_img.setAttribute("src", "images/logo-black.png");
navbar_brand.style.setProperty("color", "black", "important");
navbar.style.backgroundColor = "white";
for (let i = 1; i <= 4; i++) {
document.querySelector(".nav-link" + i).style.setProperty("color", "black", "important");
}
} else {
navbar_brand_img.setAttribute("src", "images/logo-white.png");
navbar_brand.style.setProperty("color", "white", "important");
navbar.style.backgroundColor = "inherit";
for (let i = 1; i <= 4; i++) {
document.querySelector(".nav-link" + i).style.setProperty("color", "white", "important");
}
}
};
document.querySelector(".btn-navbar").addEventListener("click", function() {
navbar_brand_img.setAttribute("src", "images/logo-black.png");
navbar_brand.style.setProperty("color", "black", "important");
navbar.style.backgroundColor = "white";
for (let i = 1; i <= 4; i++) {
document.querySelector(".nav-link" + i).style.setProperty("color", "black", "important");
}
});