-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 1.11 KB
/
app.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
const arrows = document.querySelectorAll(".arrow");
const movieLists = document.querySelectorAll('.movie-list');
arrows.forEach((arrow, i)=> {
const itemLength = movieLists[i].querySelectorAll('img').length;
let clickCounter = 0
arrow.addEventListener('click', () => {
clickCounter++;
const ratio = Math.floor(window.innerWidth/155);
if(itemLength - (6+clickCounter) + (6-ratio) >= 0) {
movieLists[i].style.transform = `translateX(${
movieLists[i].computedStyleMap().get("transform")[0].x.value -230
}px)`;
} else {
movieLists[i].style.transform = "translateX(0)";
clickCounter=0;
}
// console.log(movieLists[i].computedStyleMap().get("transform")[0].x.value);
})
})
const ball = document.querySelector('.toogle-ball')
const items = document.querySelectorAll('.navbar, .navbar-container, .sidebar, .left-menu-icon, .container, .movie-list-title');
ball.addEventListener('click', () => {
items.forEach(item => {
item.classList.toggle("active")
})
ball.classList.toggle("active")
})