EMO-TI.js
3.22 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
/* Javascrip 코드 */
const audios = [
document.getElementById("istp_audio"),
document.getElementById("istj_audio"),
document.getElementById("isfp_audio"),
document.getElementById("isfj_audio"),
document.getElementById("intp_audio"),
document.getElementById("intj_audio"),
document.getElementById("infp_audio"),
document.getElementById("infj_audio"),
document.getElementById("estp_audio"),
document.getElementById("estj_audio"),
document.getElementById("esfp_audio"),
document.getElementById("esfj_audio"),
document.getElementById("entp_audio"),
document.getElementById("entj_audio"),
document.getElementById("enfp_audio"),
document.getElementById("enfj_audio"),
];
const numMbtis = 16;
const slidesPerView = 5;
/* ========
Debugger plugin, simple demo plugin to console.log some of callbacks
======== */
function myPlugin({ swiper, extendParams, on }) {
extendParams({
debugger: false,
});
on('init', () => {
if (!swiper.params.debugger) return;
console.log('init');
});
on('click', (swiper, e) => {
if (!swiper.params.debugger) return;
console.log('click');
});
on('tap', (swiper, e) => {
if (!swiper.params.debugger) return;
console.log('tap');
});
on('doubleTap', (swiper, e) => {
if (!swiper.params.debugger) return;
console.log('doubleTap');
});
on('sliderMove', (swiper, e) => {
if (!swiper.params.debugger) return;
console.log('sliderMove');
});
on('slideChange', () => {
audios[(swiper.previousIndex + numMbtis - slidesPerView) % numMbtis].pause();
audios[(swiper.previousIndex + numMbtis - slidesPerView) % numMbtis].currentTime = 0;
audios[(swiper.activeIndex + numMbtis - slidesPerView) % numMbtis].play();
if (!swiper.params.debugger) return;
console.log('slideChange', swiper.previousIndex, '->', swiper.activeIndex);
});
on('slideChangeTransitionStart', () => {
if (!swiper.params.debugger) return;
console.log('slideChangeTransitionStart');
});
on('slideChangeTransitionEnd', () => {
if (!swiper.params.debugger) return;
console.log('slideChangeTransitionEnd');
});
on('transitionStart', () => {
if (!swiper.params.debugger) return;
console.log('transitionStart');
});
on('transitionEnd', () => {
if (!swiper.params.debugger) return;
console.log('transitionEnd');
});
on('fromEdge', () => {
if (!swiper.params.debugger) return;
console.log('fromEdge');
});
on('reachBeginning', () => {
if (!swiper.params.debugger) return;
console.log('reachBeginning');
});
on('reachEnd', () => {
if (!swiper.params.debugger) return;
console.log('reachEnd');
});
}
// Install Plugin To Swiper
Swiper.use([myPlugin]);
let swiper = new Swiper('.swiper-container', {
loop: true,
centeredSlides: true,
slidesPerView: slidesPerView,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
effect: 'coverflow',
coverflowEffect: {
rotate: 10,
depth: 100,
slideShadows: true,
// modifier:1,
// stretch:50
},
pagination: {
el: '.swiper-pagination',
type: 'bullets',
clickable: true,
},
spaceBetween: 30,
keyboard: {
enabled: true,
},
mousewheel: true,
// Enable debugger
debugger: true,
});