-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
62 lines (49 loc) · 1.68 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
//change nav style on scroll
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
var swiper = new Swiper(".mySwiper", {
slidesPerView: 1,
spaceBetween: 20,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
599: {
slidesPerView: 2,
spaceBetween: 40
},
1023: {
slidesPerView: 3,
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);
if(document.body.clientWidth < 1024) {
nav.querySelectorAll('li a').forEach(navLink => {
navLink.addEventListener('click', closeNav);
})
}