-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
145 lines (119 loc) · 4.14 KB
/
script.js
File metadata and controls
145 lines (119 loc) · 4.14 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Abrir menu
let abrirMenuMobile = () => {
document.querySelector('.menu-mobile').style.display = 'flex';
document.querySelector('.menu-bar--mobile img').style.display = 'none';
};
let menuIcon = document.querySelector('.imagem-menu');
menuIcon.addEventListener('click', abrirMenuMobile);
let fecharMenuMobile = () => {
document.querySelector('.menu-mobile').style.display = 'none';
document.querySelector('.menu-bar--mobile img').style.display = 'flex';
};
let bodySite = document.querySelector('.banner');
bodySite.addEventListener('click', fecharMenuMobile);
// Slide banner
let botaoSlideDireita = document.querySelector('.pointer-direita');
let botaoSlideEsquerda = document.querySelector('.pointer-esquerda');
botaoSlideDireita.addEventListener('click', () => {
let bannerRotativo = document.querySelector('#sliders');
if (bannerRotativo.classList.contains('banner-1')) {
bannerRotativo.classList.remove('banner-1');
bannerRotativo.classList.add('banner-2');
} else if (bannerRotativo.classList.contains('banner-2')) {
bannerRotativo.classList.remove('banner-2');
bannerRotativo.classList.add('banner-3');
} else if (bannerRotativo.classList.contains('banner-3')) {
bannerRotativo.classList.remove('banner-3');
bannerRotativo.classList.add('banner-1');
}
});
botaoSlideEsquerda.addEventListener('click', () => {
let bannerRotativo = document.querySelector('#sliders');
if (bannerRotativo.classList.contains('banner-1')) {
bannerRotativo.classList.remove('banner-1');
bannerRotativo.classList.add('banner-3');
} else if (bannerRotativo.classList.contains('banner-3')) {
bannerRotativo.classList.remove('banner-3');
bannerRotativo.classList.add('banner-2');
} else if (bannerRotativo.classList.contains('banner-2')) {
bannerRotativo.classList.remove('banner-2');
bannerRotativo.classList.add('banner-1');
}
});
/* Menu scroll desktop */
let botaoHome = document.querySelector('#botao-home');
let botaoPromocoes = document.querySelector('#botao-promocoes');
let botaoProdutos = document.querySelector('#botao-produtos');
let botaoContato = document.querySelector('#botao-contato');
let botaoCompreAgora = document.querySelector('#botao-compre-agora');
botaoHome.addEventListener('click', (botaoHome) => {
botaoHome.preventDefault();
window.scrollTo({
top:0,
left:0,
behavior: 'smooth'
});
});
botaoPromocoes.addEventListener('click', (botaoPromocoes) => {
botaoPromocoes.preventDefault();
window.scrollTo({
top:594,
left:0,
behavior: 'smooth'
});
});
botaoCompreAgora.addEventListener('click', (botaoCompreAgora) => {
botaoCompreAgora.preventDefault();
window.scrollTo({
top:594,
left:0,
behavior: 'smooth'
});
});
botaoProdutos.addEventListener('click', (botaoProdutos) => {
botaoProdutos.preventDefault();
window.scrollTo({
top:1279,
left:0,
behavior: 'smooth'
});
});
botaoContato.addEventListener('click', (botaoContato) => {
botaoContato.preventDefault();
window.scrollTo({
top:1663,
left:0,
behavior: 'smooth'
});
});
/* Menu scroll mobile */
let botaoPromocoesMobile = document.querySelector('#botao-promocoes-mobile');
let botaoProdutosMobile = document.querySelector('#botao-produtos-mobile');
let botaoContatoMobile = document.querySelector('#botao-contato--mobile');
botaoPromocoesMobile.addEventListener('click', (botaoPromocoesMobile) => {
botaoPromocoesMobile.preventDefault();
fecharMenuMobile();
window.scrollTo({
top:672,
left:0,
behavior: 'smooth'
});
});
botaoProdutosMobile.addEventListener('click', (botaoProdutosMobile) => {
botaoProdutosMobile.preventDefault();
fecharMenuMobile();
window.scrollTo({
top:1852,
left:0,
behavior: 'smooth'
});
});
botaoContatoMobile.addEventListener('click', (botaoContatoMobile) => {
botaoContatoMobile.preventDefault();
fecharMenuMobile();
window.scrollTo({
top:2746,
left:0,
behavior: 'smooth'
});
});