您好,登錄后才能下訂單哦!
這篇文章主要介紹了實現Swiper輪播圖的源碼示例,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
代碼如下:
<br>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Swiper demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<!-- Link Swiper's CSS -->
<link rel="stylesheet" href="../dist/css/swiper.min.css?1.1.11">
<!-- Demo styles -->
<style>
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;
}
.swiper-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
</style>
</head>
<body>
<!-- Swiper -->
<p class="swiper-container">
<p class="swiper-wrapper">
<p class="swiper-slide">Slide 1</p>
<p class="swiper-slide">Slide 2</p>
<p class="swiper-slide">Slide 3</p>
<p class="swiper-slide">Slide 4</p>
<p class="swiper-slide">Slide 5</p>
<p class="swiper-slide">Slide 6</p>
<p class="swiper-slide">Slide 7</p>
<p class="swiper-slide">Slide 8</p>
<p class="swiper-slide">Slide 9</p>
<p class="swiper-slide">Slide 10</p>
</p>
<!-- Add Pagination -->
<p class="swiper-pagination"></p>
</p>
<!-- Swiper JS -->
<script src="../dist/js/swiper.min.js?1.1.11"></script>
<!-- Initialize Swiper -->
<script>
var swiper = new Swiper('.swiper-container', {//小白點
pagination: '.swiper-pagination',
paginationClickable: true
});
</script>
</body>
</html>
最后 別忘了再打這些東西之前要引Swiper.css和Swiper.js插件哦!
感謝你能夠認真閱讀完這篇文章,希望小編分享的“實現Swiper輪播圖的源碼示例”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。