-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
67 lines (57 loc) · 1.63 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
/* abrir e esconder o menu toggle/hamburguer */
const nav = document.querySelector('#header nav')
const toggle = document.querySelectorAll('nav .toggle')
for( let element of toggle) {
element.addEventListener('click', ()=>{
nav.classList.toggle('show')
})
}
/* fechar o menu ao clicar no link/seção */
const menu = document.querySelectorAll('.menu ul')
for (let link of menu){
link.addEventListener('click', ()=>{
nav.classList.remove('show')
})
}
/* Testimonials caroussel slider swiper */
const swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
pagination: {
el: '.swiper-pagination',
},
mousewheel: true,
keyboard: true,
breakpoints: {
767: {
slidesPerView: 2,
setWrapperSize: true
}
}
});
/* scrollreveal: animação ao rolar a página */
const scrollReveal = ScrollReveal({
origin: 'top',
distance: '30px',
duration: 700,
reset: true,
})
if(window.screen.width < 610){
scrollReveal.reveal(
`#home .image, #home .text,
#about .image, #abut .text,
#services .text, #services .card,
#testemonials header, #testemonials .testimonials,
#contact .text, #contact .whatsappButton, #contact .infoContact
`,
{interval: 100}
)
}
/* back-to-top voltar para o inicio */
const backToTopButton = document.querySelector(".back-to-top")
window.addEventListener('scroll', function() {
if(window.scrollY >= 560 && window.screen.availWidth < 610){
backToTopButton.classList.add('show')
} else {
backToTopButton.classList.remove('show')
}
})