質問編集履歴
1
参考サイト・画像の追加、現状のコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
画像のようなスライドをswiperで作る
|
1
|
+
画像のようなスライドをswiperで作る方法を教えて下さい。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -7,3 +7,273 @@
|
|
7
7
|
1つずつのスライドもページネーションバーによって切り替えできる(3つの黒丸)入れ子構造のスライドを作りたいのですが可能でしょうか。調べてみても出てこず苦戦しています。
|
8
8
|
|
9
9
|
![イメージ説明](dc4f9d60c4f1d36293c886dc4a0a618b.jpeg)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
[質問内容を実現しているサイト](https://www.takayamado.com/)を見つけ、同じように記述してみましたが、私の方ではページネーションバーが反応しない、アローボタンが表示されないといった問題が発生してしまいました。
|
14
|
+
|
15
|
+
![上記URLの再現したい箇所](31428af0843e894f1e2e5f899ebc1190.png)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
![問題が起きている状態](9e4836d24f60e9c37d8533e315bd3b92.png)
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
現在はswiper-slideを3つ記述し、それを囲むswiper-slideを記述した状態で、script文も存在していますが動きません……。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```head
|
28
|
+
|
29
|
+
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css" />
|
30
|
+
|
31
|
+
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
```HTML
|
38
|
+
|
39
|
+
<section class="top_okashi io fade upS move">
|
40
|
+
|
41
|
+
<div class="slide_carousel swiper-container io fade upS swiper-container-initialized swiper-container-horizontal move">
|
42
|
+
|
43
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
44
|
+
|
45
|
+
<div class="swiper-slide okashi_list_item swiper-slide-active" style="width: 450px; margin-right: 20px;">
|
46
|
+
|
47
|
+
<div class="okashi_list_item io fade upS move">
|
48
|
+
|
49
|
+
<div class="slide_okashi_wrap">
|
50
|
+
|
51
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
52
|
+
|
53
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
54
|
+
|
55
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
56
|
+
|
57
|
+
<div class="swiper-slide swiper-slide-next"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div></div>
|
58
|
+
|
59
|
+
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets"><span class="swiper-pagination-bullet swiper-pagination-bullet-active"
|
60
|
+
|
61
|
+
tabindex="0" role="button" aria-label="Go to slide 1"></span>
|
62
|
+
|
63
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span></div>
|
64
|
+
|
65
|
+
<svg class="arrow_left swiper-button-disabled" tabIndex="0" role="button" aria-label="Previous slide" aria-disabled="true">
|
66
|
+
|
67
|
+
<use xlink:href="#arrow_large1_left"></use></svg>
|
68
|
+
|
69
|
+
<svg class="arrow_right" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="false">
|
70
|
+
|
71
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
72
|
+
|
73
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
74
|
+
|
75
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer"><svg class="icon_shop">
|
76
|
+
|
77
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
78
|
+
|
79
|
+
<span class="badge winter"></span>
|
80
|
+
|
81
|
+
<span class="badge spring"></span></div>
|
82
|
+
|
83
|
+
<strong>タイトル</strong>
|
84
|
+
|
85
|
+
<p>テキストテキストテキスト</p></div></div>
|
86
|
+
|
87
|
+
<div class="swiper-slide okashi_list_item swiper-slide-next" style="width: 450px; margin-right: 20px;">
|
88
|
+
|
89
|
+
<div class="okashi_list_item io fade upS move">
|
90
|
+
|
91
|
+
<div class="slide_okashi_wrap">
|
92
|
+
|
93
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
94
|
+
|
95
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
96
|
+
|
97
|
+
<div class="swiper-slide swiper-slide-prev"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
98
|
+
|
99
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div></div>
|
100
|
+
|
101
|
+
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets">
|
102
|
+
|
103
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 1"></span>
|
104
|
+
|
105
|
+
<span class="swiper-pagination-bullet swiper-pagination-bullet-active" tabindex="0" role="button" aria-label="Go to slide 2"></span></div>
|
106
|
+
|
107
|
+
<svg class="arrow_left" tabIndex="0" role="button" aria-label="Previous slide" aria-disabled="false">
|
108
|
+
|
109
|
+
<use xlink:href="#arrow_large1_left"></use></svg>
|
110
|
+
|
111
|
+
<svg class="arrow_right swiper-button-disabled" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="true">
|
112
|
+
|
113
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
114
|
+
|
115
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
116
|
+
|
117
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer"><svg class="icon_shop">
|
118
|
+
|
119
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
120
|
+
|
121
|
+
<span class="badge winter"></span>
|
122
|
+
|
123
|
+
<span class="badge autumn"></span></div>
|
124
|
+
|
125
|
+
<strong>タイトル</strong>
|
126
|
+
|
127
|
+
<p>テキストテキストテキスト</p></div></div>
|
128
|
+
|
129
|
+
<div class="swiper-slide okashi_list_item" style="width:450px;" margin-right: 20px;>
|
130
|
+
|
131
|
+
<div class="okashi_list_item io fade upS move">
|
132
|
+
|
133
|
+
<div class="slide_okashi_wrap">
|
134
|
+
|
135
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
136
|
+
|
137
|
+
<div class="swiper-wrapper">
|
138
|
+
|
139
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
140
|
+
|
141
|
+
<div class="swiper-slide swiper-slide-next"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
142
|
+
|
143
|
+
<div class="swiper-slide"><img class="swiper-lazy">
|
144
|
+
|
145
|
+
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div> </div>
|
146
|
+
|
147
|
+
<div class="swiper-slide"><img class="swiper-lazy">
|
148
|
+
|
149
|
+
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div></div>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets"> <span class="swiper-pagination-bullet swiper-pagination-bullet-active" tabindex="0" role="button" aria-label="Go to slide 1"></span>
|
154
|
+
|
155
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span>
|
156
|
+
|
157
|
+
<svg class="arrow_left swiper-button-disabled" tabIndex="0" role="button" aria-label="Previous slide" aria-disabled="true"> <use xlink:href="#arrow_large1_left"></use></svg>
|
158
|
+
|
159
|
+
<svg class="arrow_right" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="false">
|
160
|
+
|
161
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
162
|
+
|
163
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
164
|
+
|
165
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer">
|
166
|
+
|
167
|
+
<svg class="icon_shop">
|
168
|
+
|
169
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
170
|
+
|
171
|
+
<span class="badge winter"></span>
|
172
|
+
|
173
|
+
<span class="badge autumn"></span></div>
|
174
|
+
|
175
|
+
<strong>タイトル</strong>
|
176
|
+
|
177
|
+
<p>テキストテキストテキスト</p>
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
</section>
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
```javascript
|
190
|
+
|
191
|
+
<script type="text/javascript">
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
var swiperSeasonal = new Swiper ('.slide_carousel', {
|
196
|
+
|
197
|
+
loop: false,
|
198
|
+
|
199
|
+
speed: 800,
|
200
|
+
|
201
|
+
slidesPerView: 2,
|
202
|
+
|
203
|
+
centeredSlides : true,
|
204
|
+
|
205
|
+
spaceBetween: 30,
|
206
|
+
|
207
|
+
navigation: {
|
208
|
+
|
209
|
+
nextEl: '.slide_carousel > .arrow_right',
|
210
|
+
|
211
|
+
prevEl: '.slide_carousel > .arrow_left',
|
212
|
+
|
213
|
+
},
|
214
|
+
|
215
|
+
breakpoints: {
|
216
|
+
|
217
|
+
768: {
|
218
|
+
|
219
|
+
slidesPerView: 1,
|
220
|
+
|
221
|
+
spaceBetween: 20,
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
},
|
226
|
+
|
227
|
+
});
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
//個別スライド
|
232
|
+
|
233
|
+
var swiperOkashi = new Swiper ('.slide_okashi', {
|
234
|
+
|
235
|
+
nested:true,
|
236
|
+
|
237
|
+
speed: 600,
|
238
|
+
|
239
|
+
watchOverflow: true,
|
240
|
+
|
241
|
+
pagination: {
|
242
|
+
|
243
|
+
el: '.slide_okashi .swiper-pagination',
|
244
|
+
|
245
|
+
clickable: true,
|
246
|
+
|
247
|
+
},
|
248
|
+
|
249
|
+
navigation: {
|
250
|
+
|
251
|
+
nextEl: '.slide_okashi > .arrow_right',
|
252
|
+
|
253
|
+
prevEl: '.slide_okashi > .arrow_left',
|
254
|
+
|
255
|
+
},
|
256
|
+
|
257
|
+
preloadImages: false,
|
258
|
+
|
259
|
+
lazy: {
|
260
|
+
|
261
|
+
loadPrevNext: true,
|
262
|
+
|
263
|
+
loadOnTransitionStart: true,
|
264
|
+
|
265
|
+
},
|
266
|
+
|
267
|
+
});
|
268
|
+
|
269
|
+
</script>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
```
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
文字数削減のため、HTMLのコードがインデント処理出来ておりませんが、ご了承ください。
|
278
|
+
|
279
|
+
引き続き、ご回答お待ちしております。
|