-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.js
More file actions
19 lines (16 loc) · 717 Bytes
/
style.js
File metadata and controls
19 lines (16 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const h2Element = document.querySelector('div#band h2.w3-wide');
const navbar = document.querySelector("div.w3-bar");
let switchVariable = false;
h2Element.addEventListener('click', function() {
this.style.color = "red";
this.style.fontSize = "56px";
this.style.backgroundColor = "yellow"; // Poprawka: backgroundColor zamiast tylko "color"
switchVariable = !switchVariable;
});
window.addEventListener("scroll", () => {
if (window.scrollY > 350) {
navbar.style.backgroundColor = "blue"; // Poprawka: Ustawienie tła przez styl, a nie computedStyleMap
} else {
navbar.style.backgroundColor = "black"; // Poprawka: Ustawienie tła przez styl, a nie computedStyleMap
}
});