-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.js
34 lines (28 loc) · 867 Bytes
/
main.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
const scrollBtn = document.querySelector(".scroll-to-top");
const refreshButtonVisibility = () => {
if (document.documentElement.scrollTop <= 150) {
scrollBtn.style.display = "none";
} else {
scrollBtn.style.display = "block";
}
};
refreshButtonVisibility();
scrollBtn.addEventListener("click", () => {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
});
document.addEventListener("scroll", (e) => {
refreshButtonVisibility();
});
//new
const menuToggle = document.querySelector(".toggle");
const showcase = document.querySelector(".showcase");
menuToggle.addEventListener("click", () => {
menuToggle.classList.toggle("active");
showcase.classList.toggle("active");
});
//preloader
var loader = document.getElementById("preloader");
window.addEventListener("load", function () {
loader.style.display = "none";
});