使用するオプション
スライダー画像の表示枚数を変更する
スマートフォン上の表示
パソコン上の表示
ソースコード
HTML
<hr class="mf-hr mf-col-1 mf-width-expand" style="display: none">
<section id="section1" class="mf-slider-num-4">
<h1>GALLERY</h1>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="../_assets/images/design-components/1.jpg"></div>
<div class="swiper-slide"><img src="../_assets/images/design-components/2.jpg"></div>
<div class="swiper-slide"><img src="../_assets/images/design-components/3.jpg"></div>
<div class="swiper-slide"><img src="../_assets/images/design-components/4.jpg"></div>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
</section>
<!-- Carousel Library -->
<link rel="stylesheet" href="../_lib/swiper-4.5.0/css/swiper.min.css">
<script src="../_lib/swiper-4.5.0/js/swiper.min.js"></script>
CSS
.swiper-container {
width: 100%;
}
.swiper-slide img {
width: 100%;
}
JavaScript
var mySwiper = new Swiper('.swiper-container', {
autoplay: true,
loop: true,
pagination: {
el: '.swiper-pagination',
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
scrollbar: {
el: '.swiper-scrollbar',
},
})
バリエーション
mf-slider-num-6
mf-slider-num-5
mf-slider-num-4
mf-slider-num-3
mf-slider-num-2
mf-slider-num-1
備考
- スライダーライブラリは、Slick、もしくはSwiperを使用してください。