首页 > 代码库 > swiper入门之快速实现轮播--手机端
swiper入门之快速实现轮播--手机端
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<link rel="stylesheet" href="http://www.mamicode.com/swiper/swiper-3.4.1.min.css">
<script src=http://www.mamicode.com/‘swiper/swiper-3.4.1.min.js‘></script>
<style>
img{width:100%;}
</style>
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<h1>111111111111111111111111111111111111111111111111111111111</h1>
</div>
<div class="swiper-slide">
<h1>222222222222222222222222222222222222222222222222222222222</h1>
</div>
<div class="swiper-slide">
<h1>333333333333333333333333333333333333333333333333333333333</h1>
</div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div>
<div class="swiper-pagination"></div>
<div class="swiper-pagination"></div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script>
var mySwiper = new Swiper (‘.swiper-container‘, {
loop: true,
// 如果需要分页器
pagination: ‘.swiper-pagination‘,
// 如果需要前进后退按钮
nextButton: ‘.swiper-button-next‘,
prevButton: ‘.swiper-button-prev‘,
// effect : ‘cube‘,
})
</script>
</body>
</html>
swiper入门之快速实现轮播--手机端