回答編集履歴

2

情報の追加。

2016/10/16 17:59

投稿

kei344
kei344

スコア69407

test CHANGED
@@ -21,3 +21,49 @@
21
21
 
22
22
 
23
23
  とかでどうでしょう。
24
+
25
+
26
+
27
+
28
+
29
+ ---
30
+
31
+
32
+
33
+ **追記:**
34
+
35
+
36
+
37
+ `mySwiper.update()` が半端にしか効かないので`mySwiper.destroy( true, true )` で削除し、再生成する方法で。
38
+
39
+
40
+
41
+ ```JavaScript
42
+
43
+ $( window ).resize( function(){
44
+
45
+ if ( window.innerWidth > 768 ) {
46
+
47
+ mySwiper.params.direction = 'horizontal';
48
+
49
+ } else {
50
+
51
+ mySwiper.params.direction = 'vertical';
52
+
53
+ }
54
+
55
+ // mySwiper.update();
56
+
57
+ var prm = mySwiper.params; // パラメータを保存
58
+
59
+ mySwiper.destroy( true, true ); // 削除
60
+
61
+ mySwiper = new Swiper ('.swiper-container', prm ); // 再設定
62
+
63
+ } );
64
+
65
+ ```**動くサンプル:**[https://jsfiddle.net/umnLfym5/](https://jsfiddle.net/umnLfym5/)
66
+
67
+
68
+
69
+

1

ミスがあったため修正。

2016/10/16 17:58

投稿

kei344
kei344

スコア69407

test CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  if ( window.innerWidth > 768 ) {
6
6
 
7
- mySwiper.params.autoplay = direction: 'horizontal';
7
+ mySwiper.params.direction = 'horizontal';
8
8
 
9
9
  } else {
10
10
 
11
- mySwiper.params.autoplay = direction: 'vertical';
11
+ mySwiper.params.direction = 'vertical';
12
12
 
13
13
  }
14
14