-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (35 loc) · 1.34 KB
/
script.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
let items = document.querySelectorAll('.slider .item');
let next = document.getElementById('next');
let prev = document.getElementById('prev');
let active = 3;
function loadShow(){
let stt = 0;
items[active].style.transform = `none`;
items[active].style.zIndex = 1;
items[active].style.filter = 'none';
items[active].style.opacity = 1;
for(var i = active + 1; i < items.length; i++){
stt++;
items[i].style.transform = `translateX(${120*stt}px) scale(${1 - 0.2*stt}) perspective(16px) rotateY(-1deg)`;
items[i].style.zIndex = -stt;
items[i].style.filter = 'blur(5px)';
items[i].style.opacity = stt > 2 ? 0 : 0.6;
}
stt = 0;
for(var i = active - 1; i >= 0; i--){
stt++;
items[i].style.transform = `translateX(${-120*stt}px) scale(${1 - 0.2*stt}) perspective(16px) rotateY(1deg)`;
items[i].style.zIndex = -stt;
items[i].style.filter = 'blur(5px)';
items[i].style.opacity = stt > 2 ? 0 : 0.6;
}
}
loadShow();
next.onclick = function(){
active = active + 1 < items.length ? active + 1 : active;
loadShow();
}
prev.onclick = function(){
active = active - 1 >= 0 ? active - 1 : active;
loadShow();
}