-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
65 lines (54 loc) · 1.45 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
/* Open and close the menu */
const nav = document.querySelector("#header nav")
const toggle = document.querySelectorAll("nav .toggle")
for (const element of toggle) {
element.addEventListener("click", function() {
nav.classList.toggle("show")
})
}
/* close the menu when clicked */
const elementList = document.querySelectorAll("nav ul li a")
for (const each of elementList) {
each.addEventListener("click", function() {
nav.classList.remove("show")
})
}
/* enable header shadow on scroll */
const header = document.querySelector("#header")
const navHeight = header.offsetHeight
window.addEventListener("scroll", function() {
if (window.scrollY >= navHeight ) {
header.classList.add("scroll")
} else {
header.classList.remove("scroll")
}
})
/* testimonials slider */
const swiper = new Swiper(".swiper-container", {
slidesPerView: 1,
pagination: {
el: ".swiper-pagination"
},
mousewheel: true,
keyboard: true,
breakpoints: {
767: {
slidesPerView: 2,
}
}
})
/* scroll reveal properties */
const scrollReveal = ScrollReveal({
origin: 'top',
distance: '30px',
duration: 700,
reset: true,
})
scrollReveal.reveal(
`#home .image, #home .text,
#about .image, #about .text,
#services header, #services .card,
#testimonials header, #testimonials .testimonial,
#contact .text, #contact .links
`,
{interval: 100})