質問編集履歴
3
必要の無い部分を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,22 +38,10 @@
|
|
38
38
|
```footerのjs記述部分
|
39
39
|
|
40
40
|
<script src="<?php print get_template_directory_uri(); ?>/js/swiper.js"></script>
|
41
|
-
<script>
|
41
|
+
<script>
|
42
|
-
function slideSwiper(index) {
|
43
|
-
swiper.slideTo(index);
|
44
|
-
}
|
45
|
-
|
46
|
-
var swiper
|
42
|
+
var swiper = new Swiper('.swiper-container');
|
43
|
+
</script>
|
47
44
|
|
48
|
-
//Swiper生成
|
49
|
-
var mySwiper = new Swiper('.swiper-container', {
|
50
|
-
navigation: {
|
51
|
-
nextEl: '.swiper-button-next',
|
52
|
-
prevEl: '.swiper-button-prev',
|
53
|
-
},
|
54
|
-
});
|
55
|
-
</script>
|
56
|
-
|
57
45
|
```
|
58
46
|
|
59
47
|
```CSS
|
@@ -69,9 +57,9 @@
|
|
69
57
|
|
70
58
|
}
|
71
59
|
|
60
|
+
```
|
72
61
|
|
73
62
|
|
74
|
-
|
75
63
|
### 試したこと
|
76
64
|
|
77
65
|
画像フィールドを読み込んでいく場合のスライダーは作れたのですが
|
2
cssの一部削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -69,18 +69,6 @@
|
|
69
69
|
|
70
70
|
}
|
71
71
|
|
72
|
-
/**/
|
73
|
-
.swiper-pagination-thumb{
|
74
|
-
width: 100px;
|
75
|
-
height: 60px;
|
76
|
-
display: inline-block;
|
77
|
-
background-size: contain;
|
78
|
-
background-repeat: no-repeat;
|
79
|
-
background-position: center;
|
80
|
-
border: 3px solid #eee;
|
81
|
-
margin: 5px;
|
82
|
-
cursor: pointer;
|
83
|
-
}
|
84
72
|
|
85
73
|
|
86
74
|
|
1
JavaScript、css部分のコードも記載しました。余分な処理(ページネーション部分などを削除しました)
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
ACF、phpともに初心者なので基本を何か間違っているのかもしれませんので
|
7
7
|
ヒントでも何でもいいのでご教授お願いします・・・。
|
8
8
|
|
9
|
+
JavaScript、css部分のコードも記載しました。
|
9
10
|
|
10
11
|
### 発生している問題・エラーメッセージ
|
11
12
|
|
@@ -16,7 +17,7 @@
|
|
16
17
|
|
17
18
|
### 該当のソースコード
|
18
19
|
|
19
|
-
```php
|
20
|
+
```phpとhtml (wordpressの出力部分)
|
20
21
|
|
21
22
|
//swiperのコンテナ
|
22
23
|
<div class="swiper-container">
|
@@ -31,18 +32,64 @@
|
|
31
32
|
<?php endforeach; ?>
|
32
33
|
<?php endif; ?>
|
33
34
|
</div>
|
34
|
-
//↓ページネーションとか
|
35
|
-
<div class="swiper-button-next swiper-button-white"></div>
|
36
|
-
<div class="swiper-button-prev swiper-button-white"></div>
|
37
35
|
</div>
|
38
|
-
<div class="swiper-pagination-thumbs"></div>
|
39
36
|
```
|
40
37
|
|
38
|
+
```footerのjs記述部分
|
39
|
+
|
40
|
+
<script src="<?php print get_template_directory_uri(); ?>/js/swiper.js"></script>
|
41
|
+
<script>
|
42
|
+
function slideSwiper(index) {
|
43
|
+
swiper.slideTo(index);
|
44
|
+
}
|
45
|
+
|
46
|
+
var swiper; //グローバル変数
|
47
|
+
|
48
|
+
//Swiper生成
|
49
|
+
var mySwiper = new Swiper('.swiper-container', {
|
50
|
+
navigation: {
|
51
|
+
nextEl: '.swiper-button-next',
|
52
|
+
prevEl: '.swiper-button-prev',
|
53
|
+
},
|
54
|
+
});
|
55
|
+
</script>
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
```CSS
|
60
|
+
|
61
|
+
.swiper-container {
|
62
|
+
width: 100%;
|
63
|
+
height: 200px;
|
64
|
+
}
|
65
|
+
.swiper-slide {
|
66
|
+
background-size: contain;
|
67
|
+
background-repeat: no-repeat;
|
68
|
+
background-position: center;
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
/**/
|
73
|
+
.swiper-pagination-thumb{
|
74
|
+
width: 100px;
|
75
|
+
height: 60px;
|
76
|
+
display: inline-block;
|
77
|
+
background-size: contain;
|
78
|
+
background-repeat: no-repeat;
|
79
|
+
background-position: center;
|
80
|
+
border: 3px solid #eee;
|
81
|
+
margin: 5px;
|
82
|
+
cursor: pointer;
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
41
87
|
### 試したこと
|
42
88
|
|
43
89
|
画像フィールドを読み込んでいく場合のスライダーは作れたのですが
|
44
90
|
ギャラリーでforeachを使ってもうまくいきませんでした。
|
45
91
|
|
92
|
+
|
46
93
|
### 補足情報(FW/ツールのバージョンなど)
|
47
94
|
|
48
95
|
wordpress4.9.5
|