Add first work
This commit is contained in:
commit
4046db6553
3 changed files with 577 additions and 0 deletions
21
w1/p1/app.js
Normal file
21
w1/p1/app.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
/** @type {HTMLElement} */
|
||||
let headerElement = null;
|
||||
|
||||
const onPageScrolled = function () {
|
||||
if (window.pageYOffset > 0) {
|
||||
headerElement.classList.replace("header__normal", "header__scrolled");
|
||||
} else {
|
||||
headerElement.classList.replace("header__scrolled", "header__normal");
|
||||
}
|
||||
}
|
||||
|
||||
const init = function () {
|
||||
headerElement = document.querySelector("header");
|
||||
window.addEventListener("scroll", _ => onPageScrolled());
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
init()
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue