-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (21 loc) · 808 Bytes
/
Copy pathscript.js
File metadata and controls
25 lines (21 loc) · 808 Bytes
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
function ScrollSmooth(link) {
link.addEventListener("click", function (e) {
e.preventDefault();
const href = link.getAttribute("href");
if (href === "#")
window.scrollTo({
top: 0,
behavior: "smooth",
});
if (href !== "#" && href.startsWith("#")) {
const sectionEl = document.querySelector(href);
sectionEl.scrollIntoView({ behavior: "smooth" });
}
})
}
var alllinks = document.querySelectorAll("a:link");
alllinks.forEach(ScrollSmooth);
const headerEl = document.querySelector(".header");
var openEl = document.getElementsByName("menu-outline")[0];
var closeEl = document.getElementsByName("close-outline")[0];
closeEl.classList.toggle("hideButton");