-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.js
36 lines (30 loc) · 969 Bytes
/
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
const modal = {
open() { // objeto
// abrir modal
// adicionar classe active ao modal
document.querySelector('.modal-overlay') // pesquisa pelo seletor
.classList.add('active') // adiciona active
},
close() {
// fechar o MODAL
// remover a classe active do modal
document.querySelector('.modal-overlay') // pesquisa pelo seletor
.classList.remove('active') // remove o active
}
}
const [scrollX, setScrollX] = useState(0);
const leftArrow = () => {
let x = scrollX + Math.round(window.innerWidth / 2);
if(x > 0) {
x = 0;
}
setScrollX(x);
}
const rightArrow = () => {
let x = scrollX - Math.round(window.innerWidth / 2);
let listW = items.results.length * 150; // largura da lista inteira
if ((window.innerWidth - listW) > x) {
x = (window.innerWidth - listW) - 60;
}
setScrollX(x);
}