-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
93 lines (77 loc) · 2.05 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Scroll effect
const button = document.getElementById("button-top");
const nav = document.getElementById("nav");
let lastScrollTop = 0;
window.addEventListener("scroll", function () {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
if (scrollTop > 300) {
nav.classList.add("show__nav-bg");
button.classList.add("active");
} else {
nav.classList.remove("show__nav-bg");
button.classList.remove("active");
}
if (scrollTop > lastScrollTop) {
nav.classList.add("hidden");
} else {
nav.classList.remove("hidden");
}
lastScrollTop = scrollTop;
});
// Header responsive
const links = document.querySelectorAll(".link");
const buttonMenu = document.getElementById("button-menu");
const menu = document.querySelector(".nav__links");
buttonMenu.addEventListener("click", () => {
menu.classList.toggle("show__menu");
});
links.forEach((link) => {
link.addEventListener("click", function () {
menu.classList.remove("show__menu");
});
});
// Reveal option
const scrollRevealOption = {
distance: "50px",
origin: "bottom",
duration: 800,
};
// header container
ScrollReveal().reveal(".header__container p", {
...scrollRevealOption,
});
ScrollReveal().reveal(".history__container img", {
...scrollRevealOption,
delay: 200,
});
ScrollReveal().reveal(".history__description", {
...scrollRevealOption,
});
ScrollReveal().reveal(".header__container h1", {
...scrollRevealOption,
delay: 200,
});
ScrollReveal().reveal(".header__button", {
...scrollRevealOption,
delay: 300,
});
// meal container
ScrollReveal().reveal(".meal__card", {
...scrollRevealOption,
interval: 200,
});
// destination container
ScrollReveal().reveal(".destination__card", {
duration: 1000,
interval: 200,
});
// seller container
ScrollReveal().reveal(".seller__card", {
...scrollRevealOption,
interval: 200,
});
// monument container
ScrollReveal().reveal(".monument__card", {
...scrollRevealOption,
interval: 200,
});