# **基本使用**
1.下载和引入插件。swiper.min.js和swiper.min.css文件。可下载[Swiper文件](https://www.swiper.com.cn/download/index.html#file1)或使用[CDN](https://www.swiper.com.cn/cdn/index.html)。
```
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<link rel="stylesheet" href="css/swiper.min.css">
</head>
<body>
<script src="js/swiper.min.js"></script>
</body>
</html>
```
2.添加HTML内容
```
<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>
</div>
```
3.设置样式。不添加的话,默认等于父容器的宽度,高度为内容高度
```
<style>
*{padding: 0; margin: 0; border: 0; list-style: none;}
.swiper-container{width: 600px; height: 400px; background:pink; margin:100px auto;}
</style>
```
4.初始化Swiper
```
//js写法
<script>
window.onload = function(){
var swiper = new Swiper('.swiper-container');
}
</script>
//zepto和jquery写法
<script>
$(function(){
var swiper = new Swiper('.swiper-container');
})
</script>
```
**以下均为js写法**
- Swiper
- 01-Swiper简介
- 02-Swiper初体验
- 03-分页器
- 04-前进后退按钮,上一张下一张切换
- 05-滚动条
- 06-自动播放
- 07-无缝轮播
- 08-键盘控制
- 09-鼠标滚轮
- 10-切换效果
- 01-effects
- 02-fadeEffect-淡入淡出
- 03-cubeEffect-一般用于广告
- 04-coverflowEffect相册作品展示
- 05-flipEffect-旋转门
- 11-拓展
- 12-Swiper+Animate.css
- 13-视差拓展
- 14-virtual
- 15-图片懒加载
- 01-loadPrevNext
- 02-loadPrevNextAmount
- 03-loadOnTransitionStart
- 04-elementClass
- 16-3d