質問編集履歴
1
参考サイト・画像の追加、現状のコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,140 @@
|
|
1
|
-
画像のようなスライドをswiperで作る
|
1
|
+
画像のようなスライドをswiperで作る方法を教えて下さい。
|
2
2
|
|
3
3
|
3つのスライドを包括するスライドが1つあり(画像の矢印ボタンで動く)
|
4
4
|
1つずつのスライドもページネーションバーによって切り替えできる(3つの黒丸)入れ子構造のスライドを作りたいのですが可能でしょうか。調べてみても出てこず苦戦しています。
|
5
|
-

|
5
|
+

|
6
|
+
|
7
|
+
[質問内容を実現しているサイト](https://www.takayamado.com/)を見つけ、同じように記述してみましたが、私の方ではページネーションバーが反応しない、アローボタンが表示されないといった問題が発生してしまいました。
|
8
|
+

|
9
|
+
|
10
|
+

|
11
|
+
|
12
|
+
現在はswiper-slideを3つ記述し、それを囲むswiper-slideを記述した状態で、script文も存在していますが動きません……。
|
13
|
+
|
14
|
+
```head
|
15
|
+
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css" />
|
16
|
+
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
|
17
|
+
```
|
18
|
+
|
19
|
+
```HTML
|
20
|
+
<section class="top_okashi io fade upS move">
|
21
|
+
<div class="slide_carousel swiper-container io fade upS swiper-container-initialized swiper-container-horizontal move">
|
22
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
23
|
+
<div class="swiper-slide okashi_list_item swiper-slide-active" style="width: 450px; margin-right: 20px;">
|
24
|
+
<div class="okashi_list_item io fade upS move">
|
25
|
+
<div class="slide_okashi_wrap">
|
26
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
27
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
28
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
29
|
+
<div class="swiper-slide swiper-slide-next"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div></div>
|
30
|
+
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets"><span class="swiper-pagination-bullet swiper-pagination-bullet-active"
|
31
|
+
tabindex="0" role="button" aria-label="Go to slide 1"></span>
|
32
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span></div>
|
33
|
+
<svg class="arrow_left swiper-button-disabled" tabIndex="0" role="button" aria-label="Previous slide" aria-disabled="true">
|
34
|
+
<use xlink:href="#arrow_large1_left"></use></svg>
|
35
|
+
<svg class="arrow_right" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="false">
|
36
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
37
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
38
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer"><svg class="icon_shop">
|
39
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
40
|
+
<span class="badge winter"></span>
|
41
|
+
<span class="badge spring"></span></div>
|
42
|
+
<strong>タイトル</strong>
|
43
|
+
<p>テキストテキストテキスト</p></div></div>
|
44
|
+
<div class="swiper-slide okashi_list_item swiper-slide-next" style="width: 450px; margin-right: 20px;">
|
45
|
+
<div class="okashi_list_item io fade upS move">
|
46
|
+
<div class="slide_okashi_wrap">
|
47
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
48
|
+
<div class="swiper-wrapper" style="transition-duration: 0ms; transform: translate3d(0px, 0px, 0px);">
|
49
|
+
<div class="swiper-slide swiper-slide-prev"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
50
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div></div>
|
51
|
+
<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets">
|
52
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 1"></span>
|
53
|
+
<span class="swiper-pagination-bullet swiper-pagination-bullet-active" tabindex="0" role="button" aria-label="Go to slide 2"></span></div>
|
54
|
+
<svg class="arrow_left" tabIndex="0" role="button" aria-label="Previous slide" aria-disabled="false">
|
55
|
+
<use xlink:href="#arrow_large1_left"></use></svg>
|
56
|
+
<svg class="arrow_right swiper-button-disabled" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="true">
|
57
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
58
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
59
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer"><svg class="icon_shop">
|
60
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
61
|
+
<span class="badge winter"></span>
|
62
|
+
<span class="badge autumn"></span></div>
|
63
|
+
<strong>タイトル</strong>
|
64
|
+
<p>テキストテキストテキスト</p></div></div>
|
65
|
+
<div class="swiper-slide okashi_list_item" style="width:450px;" margin-right: 20px;>
|
66
|
+
<div class="okashi_list_item io fade upS move">
|
67
|
+
<div class="slide_okashi_wrap">
|
68
|
+
<div class="slide_okashi swiper-container swiper-container-initialized swiper-container-horizontal">
|
69
|
+
<div class="swiper-wrapper">
|
70
|
+
<div class="swiper-slide swiper-slide-active"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
71
|
+
<div class="swiper-slide swiper-slide-next"><img alt="" class="swiper-lazy swiper-lazy-loaded" src="img/product_01.jpg"></div>
|
72
|
+
<div class="swiper-slide"><img class="swiper-lazy">
|
73
|
+
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div> </div>
|
74
|
+
<div class="swiper-slide"><img class="swiper-lazy">
|
75
|
+
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div></div>
|
76
|
+
|
77
|
+
<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>
|
78
|
+
<span class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="Go to slide 2"></span>
|
79
|
+
<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>
|
80
|
+
<svg class="arrow_right" tabIndex="0" role="button" aria-label="Next slide" aria-disabled="false">
|
81
|
+
<use xlink:href="#arrow_large1_right"></use></svg>
|
82
|
+
<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span></div>
|
83
|
+
<a href="" target="_blank" class="okashi_shop" rel="noopener noreferrer">
|
84
|
+
<svg class="icon_shop">
|
85
|
+
<use xlink:href="#icon_shop"></use></svg></a>
|
86
|
+
<span class="badge winter"></span>
|
87
|
+
<span class="badge autumn"></span></div>
|
88
|
+
<strong>タイトル</strong>
|
89
|
+
<p>テキストテキストテキスト</p>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
</section>
|
94
|
+
```
|
95
|
+
```javascript
|
96
|
+
<script type="text/javascript">
|
97
|
+
|
98
|
+
var swiperSeasonal = new Swiper ('.slide_carousel', {
|
99
|
+
loop: false,
|
100
|
+
speed: 800,
|
101
|
+
slidesPerView: 2,
|
102
|
+
centeredSlides : true,
|
103
|
+
spaceBetween: 30,
|
104
|
+
navigation: {
|
105
|
+
nextEl: '.slide_carousel > .arrow_right',
|
106
|
+
prevEl: '.slide_carousel > .arrow_left',
|
107
|
+
},
|
108
|
+
breakpoints: {
|
109
|
+
768: {
|
110
|
+
slidesPerView: 1,
|
111
|
+
spaceBetween: 20,
|
112
|
+
}
|
113
|
+
},
|
114
|
+
});
|
115
|
+
|
116
|
+
//個別スライド
|
117
|
+
var swiperOkashi = new Swiper ('.slide_okashi', {
|
118
|
+
nested:true,
|
119
|
+
speed: 600,
|
120
|
+
watchOverflow: true,
|
121
|
+
pagination: {
|
122
|
+
el: '.slide_okashi .swiper-pagination',
|
123
|
+
clickable: true,
|
124
|
+
},
|
125
|
+
navigation: {
|
126
|
+
nextEl: '.slide_okashi > .arrow_right',
|
127
|
+
prevEl: '.slide_okashi > .arrow_left',
|
128
|
+
},
|
129
|
+
preloadImages: false,
|
130
|
+
lazy: {
|
131
|
+
loadPrevNext: true,
|
132
|
+
loadOnTransitionStart: true,
|
133
|
+
},
|
134
|
+
});
|
135
|
+
</script>
|
136
|
+
|
137
|
+
```
|
138
|
+
|
139
|
+
文字数削減のため、HTMLのコードがインデント処理出来ておりませんが、ご了承ください。
|
140
|
+
引き続き、ご回答お待ちしております。
|