-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.js
79 lines (62 loc) · 1.91 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
// Change nav style while scrolling
window.addEventListener('scroll', ()=>{
document.querySelector('nav').classList.toggle('window-scrolled', window.scrollY > 0);
})
// Contact Buttons (Circular Text Buttons)
const textButtons = document.querySelectorAll('.contact__btn');
textButtons.forEach(textButton => {
let text = textButton.querySelector('p');
text.innerHTML = text.innerHTML.split('').map((character, index) => `<span style="transform: rotate(${index * 12}deg)
">${character}</span>`).join()
})
// Swiper JS (Gallery Section)
var swiper = new Swiper(".mySwiper", {
slidesPerView: 1,
spaceBetween: 20,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints:{
599: {
slidesPerView: 1,
spaceBetween: 40
},
1023: {
slidesPerView: 2,
spaceBetween: 60
}
}
});
const nav = document.querySelector('.nav__links');
const openNavBtn = document.querySelector('#nav__toggle-open');
const closeNavBtn = document.querySelector('#nav__toggle-close');
const openNav = () => {
nav.style.display = 'flex';
openNavBtn.style.display = 'none';
closeNavBtn.style.display = 'inline-block';
}
openNavBtn.addEventListener('click', openNav);
const closeNav = () => {
nav.style.display = 'none';
openNavBtn.style.display = 'inline-block';
closeNavBtn.style.display = 'none';
}
closeNavBtn.addEventListener('click', closeNav);
nav.querySelectorAll('li a').forEach(navLink => {
navLink.addEventListener('click', closeNav);
})
// Swiper JS (Family Section)
var swiper = new Swiper(".mySwiper", {
slidesPerView: 1,
grabCursor: true,
loop: true,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
});