回答編集履歴

1

解決法追記

2019/02/15 08:32

投稿

x_x
x_x

スコア13749

test CHANGED
@@ -15,3 +15,29 @@
15
15
  swiper.jsで複数のスライダーを設置したが左右ボタンが効かない
16
16
 
17
17
  [https://teratail.com/questions/118992](https://teratail.com/questions/118992)
18
+
19
+
20
+
21
+ -- 追記
22
+
23
+ あらかじめ Swiper を用意しておくのが難しいので、モーダルが開いたときに作ったほうがいいかと思います。
24
+
25
+ ```jQuery
26
+
27
+ var mySwiper;
28
+
29
+ $(document).on('shown.bs.modal', function(event) {
30
+
31
+ var container = $(event.target);
32
+
33
+ mySwiper = new Swiper(container.find('.swiper-container')[0], { /* options */ });
34
+
35
+ }).on('hide.bs.modal', function(event) {
36
+
37
+ mySwiper.destroy();
38
+
39
+ });
40
+
41
+ ```
42
+
43
+ [https://getbootstrap.com/docs/3.3/javascript/#modals-events](https://getbootstrap.com/docs/3.3/javascript/#modals-events)