-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
121 lines (103 loc) · 2.85 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const menuBtn = document.getElementById("menu-btn");
const navLinks = document.getElementById("nav-links");
const menuBtnIcon = menuBtn.querySelector("i");
menuBtn.addEventListener("click", (e) => {
navLinks.classList.toggle("open");
const isOpen = navLinks.classList.contains("open");
menuBtnIcon.setAttribute("class", isOpen ? "ri-close-line" : "ri-menu-line");
});
navLinks.addEventListener("click", (e) => {
navLinks.classList.remove("open");
menuBtnIcon.setAttribute("class", "ri-menu-line");
});
const scrollRevealOption = {
origin: "bottom",
distance: "50px",
duration: 1000,
};
ScrollReveal().reveal(".header__container h1", {
...scrollRevealOption,
});
ScrollReveal().reveal(".header__container form", {
...scrollRevealOption,
delay: 500,
});
ScrollReveal().reveal(".header__container img", {
...scrollRevealOption,
delay: 1000,
});
ScrollReveal().reveal(".range__card", {
duration: 1000,
interval: 500,
});
ScrollReveal().reveal(".location__image img", {
...scrollRevealOption,
origin: "right",
});
ScrollReveal().reveal(".location__content .section__header", {
...scrollRevealOption,
delay: 500,
});
ScrollReveal().reveal(".location__content p", {
...scrollRevealOption,
delay: 1000,
});
ScrollReveal().reveal(".location__content .location__btn", {
...scrollRevealOption,
delay: 1500,
});
const selectCards = document.querySelectorAll(".select__card");
selectCards[0].classList.add("show__info");
const price = ["225", "455", "275", "625", "395"];
const priceEl = document.getElementById("select-price");
function updateSwiperImage(eventName, args) {
if (eventName === "slideChangeTransitionStart") {
const index = args && args[0].realIndex;
priceEl.innerText = price[index];
selectCards.forEach((item) => {
item.classList.remove("show__info");
});
selectCards[index].classList.add("show__info");
}
}
const swiper = new Swiper(".swiper", {
loop: true,
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: "auto",
coverflowEffect: {
rotate: 0,
depth: 500,
modifier: 1,
scale: 0.75,
slideShadows: false,
stretch: -100,
},
onAny(event, ...args) {
updateSwiperImage(event, args);
},
});
ScrollReveal().reveal(".story__card", {
...scrollRevealOption,
interval: 500,
});
const banner = document.querySelector(".banner__wrapper");
const bannerContent = Array.from(banner.children);
bannerContent.forEach((item) => {
const duplicateNode = item.cloneNode(true);
duplicateNode.setAttribute("aria-hidden", true);
banner.appendChild(duplicateNode);
});
ScrollReveal().reveal(".download__image img", {
...scrollRevealOption,
origin: "right",
});
ScrollReveal().reveal(".download__content .section__header", {
...scrollRevealOption,
delay: 500,
});
ScrollReveal().reveal(".download__links", {
...scrollRevealOption,
delay: 1000,
});