回答編集履歴
1
解決法追記
answer
CHANGED
@@ -6,4 +6,17 @@
|
|
6
6
|
|
7
7
|
さらに複数設置していることで起きている問題(両方動いてしまう)と、Bootstrapとの問題があるようですが、複数のほうは過去の質問では解決しているようでよくわかりません。
|
8
8
|
swiper.jsで複数のスライダーを設置したが左右ボタンが効かない
|
9
|
-
[https://teratail.com/questions/118992](https://teratail.com/questions/118992)
|
9
|
+
[https://teratail.com/questions/118992](https://teratail.com/questions/118992)
|
10
|
+
|
11
|
+
-- 追記
|
12
|
+
あらかじめ Swiper を用意しておくのが難しいので、モーダルが開いたときに作ったほうがいいかと思います。
|
13
|
+
```jQuery
|
14
|
+
var mySwiper;
|
15
|
+
$(document).on('shown.bs.modal', function(event) {
|
16
|
+
var container = $(event.target);
|
17
|
+
mySwiper = new Swiper(container.find('.swiper-container')[0], { /* options */ });
|
18
|
+
}).on('hide.bs.modal', function(event) {
|
19
|
+
mySwiper.destroy();
|
20
|
+
});
|
21
|
+
```
|
22
|
+
[https://getbootstrap.com/docs/3.3/javascript/#modals-events](https://getbootstrap.com/docs/3.3/javascript/#modals-events)
|