回答編集履歴

1

コメントを受けて追記

2020/08/27 06:12

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36115

test CHANGED
@@ -9,3 +9,81 @@
9
9
  [Autoplay | Swiper Demos](https://swiperjs.com/demos/#autoplay)
10
10
 
11
11
  [Loop Mode / Infinite Loop | Swiper Demos](https://swiperjs.com/demos/#loop_mode_infinite_loop)
12
+
13
+
14
+
15
+ # コメントを受けて追記
16
+
17
+
18
+
19
+ 手ごわかったです。
20
+
21
+ まさか、GitHubのソースを読みにいくことになるとは。
22
+
23
+
24
+
25
+ [サンプル](https://jsfiddle.net/Lhankor_Mhy/b8f97krc/)
26
+
27
+
28
+
29
+ ```js
30
+
31
+ var mySwiper = new Swiper('.swiper-container', {
32
+
33
+ direction: 'horizontal',
34
+
35
+ loopPreventsSlide: false,
36
+
37
+ freeMode: true,
38
+
39
+ speed: 5000,
40
+
41
+ autoplay: {
42
+
43
+ delay: 0,
44
+
45
+ },
46
+
47
+ loop: true,
48
+
49
+ });
50
+
51
+ mySwiper.on('slideChangeTransitionEnd', function(swiper){
52
+
53
+ swiper.autoplay.start();
54
+
55
+ });
56
+
57
+ document.querySelector('.swiper-button-prev').addEventListener('click', function(e){
58
+
59
+ mySwiper.slideTo(mySwiper.activeIndex -2, 1000);
60
+
61
+ });
62
+
63
+ document.querySelector('.swiper-button-next').addEventListener('click', function(e){
64
+
65
+ mySwiper.slidePrev(1000);
66
+
67
+ mySwiper.slideNext(1000);
68
+
69
+ });
70
+
71
+ ```
72
+
73
+
74
+
75
+ ```css
76
+
77
+ .swiper-wrapper{
78
+
79
+ transition-timing-function: linear !important;
80
+
81
+ }
82
+
83
+ .swiper-slide img{
84
+
85
+ width: 100%;
86
+
87
+ }
88
+
89
+ ```