<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div>
<div class="swiper-slide">Slide 7</div>
<div class="swiper-slide">Slide 8</div>
<div class="swiper-slide">Slide 9</div>
<div class="swiper-slide">Slide 10</div>
</div>
</div>
<!-- Tiny-Swiper JS -->
<script src="https://unpkg.com/tiny-swiper@latest/lib/index.min.js"></script>
<!-- Initialize Tiny-Swiper -->
<script>
var swiper = new Swiper(".swiper-container");
</script>
html,
body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
html,
body,
.swiper-container,
.swiper-wrapper {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
/* basic */
.swiper-container {
position: relative;
overflow: hidden;
}
.swiper-container,
.swiper-wrapper {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
.swiper-slide {
position: relative;
display: flex;
flex-shrink: 0;
justify-content: center;
width: 100%;
height: 100%;
font-size: 18px;
align-items: center;
cursor: grab;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: top;
}
/* plugin pagination */
.swiper-plugin-pagination {
display: block;
position: absolute;
top: 50%;
right: 2.2rem;
width: 0.5rem;
transform: translateY(-50%);
&__item {
display: block;
margin: 100% 0;
width: 100%;
padding-top: 100%;
height: 0;
border-radius: 50% !important;
border: none;
background: #fff;
transition: background ease 0.2s;
cursor: pointer;
}
&__item.is-active {
background: #333;
}
}
/* image lazyload */
.swiper-lazy {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
transition: all ease 300ms;
}
.swiper-lazy-preloader {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.swiper-lazy-loaded {
opacity: 1;
}
.swiper-lazy-preloader::after {
display: block;
content: "";
position: absolute;
left: 50%;
top: 50%;
margin: -15px 0 0 -15px;
width: 30px;
height: 30px;
border: 2px solid rgba(0, 0, 0, 0.88);
border-radius: 50%;
border-bottom-color: transparent;
transform-origin: 50%;
animation: rotate 1s infinite linear;
}
@keyframes rotate {
0% {
transform: rotate3d(0, 0, 0, 0);
}
100% {
transform: rotate3d(0, 0, 1, 360deg);
}
}
.swiper-slide:nth-child(1) {
background: lavender;
}
.swiper-slide:nth-child(2) {
background: lemonchiffon;
}
.swiper-slide:nth-child(3) {
background: beige;
}
.swiper-slide:nth-child(4) {
background: blanchedalmond;
}
.swiper-slide:nth-child(5) {
background: powderblue;
}
.swiper-slide:nth-child(6) {
background: khaki;
}
.swiper-slide:nth-child(7) {
background: wheat;
}
.swiper-slide:nth-child(8) {
background: thistle;
}
.swiper-slide:nth-child(9) {
background: darkgoldenrod;
}
.swiper-slide:nth-child(10) {
background: olivedrab;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.