https://github.com/chokcoco/iswiper
一款小而美的轻量级、高性能移动端滑动插件。
https://github.com/chokcoco/iswiper
swiper
Last synced: about 1 month ago
JSON representation
一款小而美的轻量级、高性能移动端滑动插件。
- Host: GitHub
- URL: https://github.com/chokcoco/iswiper
- Owner: chokcoco
- Created: 2016-10-05T10:22:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-13T16:12:50.000Z (about 8 years ago)
- Last Synced: 2025-04-20T02:34:35.193Z (about 2 months ago)
- Topics: swiper
- Language: JavaScript
- Homepage:
- Size: 41 KB
- Stars: 18
- Watchers: 4
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/chokcoco/iswiper)
# iswiper
一款小而美的轻量级、高性能移动端滑动插件。
保留最基本的功能,提供最大限度的拓展。
## Features
- 支持横屏、竖屏滚动
- 支持无限轮播
- 支持手势滑动
- 支持进度条## Build
使用 Gulp 构建,可查看完整 Demo。安装包:
```
$ npm install mobile_iswiper
```运行:
```
$ npm start
```## Use
引入 `iswiper.css` 及 `iswiper.js` 。支持 AMD 、CMD 规范。
```html
var swiper = new Swiper();
```
## API
```javascript
var swiper = new Swiper({
// 容器
container: '.swiper',
// 每页 className
item: '.item',
// 默认竖屏,可选横屏 horizontal
direction: 'vertical',
// 激活态 className
activeClass: 'active',
// 默认不无限首尾相连
infinite: false,
// 滑动切换距离阀值
threshold: 30,
// 切换动画时间
duration: 600,
// 自动切换,默认为 false,自动切换必须 infinite:true
autoSwitch: false,
// 切换间隔
loopTime: 5000,
// 切换缓动函数,默认为 linear,可传入 cubic-bezier()
easing: "linear",
// 进度条,默认没有进度条,可选 true 且需要加上进度条 html 代码
progressBar:false
});
```- `next`: 滑动到到下一屏
```javascript
var swiper = new Swiper();
swiper.next();
```- `go`: 主动滑动到指定界面。
```javascript
var swiper = new Swiper();
swiper.go(1);
```- `resetLoop`: 重置滚动轮播
```javascript
var swiper = new Swiper();
swiper.resetLoop();
```## License
MIT