GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - donglegend/swiper: 为移动端而生的滑动框架,无依赖,轻盈小巧,性能极致

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

51 Commits
51 Commits

Folders and files

NameName
Last commit message
Last commit date
dist
dist
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
bower.json
bower.json
 
 
gulpfile.js
gulpfile.js
 
 
package.json
package.json
 
 

Repository files navigation

##swiper

为移动端而生的滑动框架,无依赖,轻盈小巧,性能极致

体验

扫描二维码

demo

http://wechatui.github.io/swiper

##安装

  • 你可以在https://github.com/wechatui/swiper/releases下载最新发布的版本

  • 也可以使用bower进行安装,运行bower install iswiper

##用法

<div class="swiper">
    <div class="item">
        <h2 class="title fadeInUp animated">它无孔不入</h2>
    </div>
    <div class="item">
        <h2 class="title fadeInUp animated">你无处可藏</h2>
    </div>

    <div class="item">
        <h2 class="title fadeInUp animated">不是它可恶</h2>
    </div>

    <div class="item">
        <h2 class="title fadeInUp animated">而是它不懂你</h2>
    </div>

    <div class="item">
        <h2 class="title fadeInUp animated">我们试图</h2>
    </div>

    <div class="item">
        <h2 class="title fadeInUp animated">做些改变</h2>
    </div>
</div>
<script src="../swiper.js"></script>
<script>
    var swpier = new Swiper();
</script>

同样,也swiper.js也支持AMD或CMD规范,可以用requirejs或seajs进行加载。

<script src="path/to/require.js"></script>
<script>
    require(['swiper'], function(Swiper){
        var swiper = new Swiper({direction: 'horizontal'});
    });
</script>
<script src="path/to/sea.js"></script>
<script>
    seajs.use(['swiper'], function(Swiper){
        var swiper = new Swiper();
    });
    //define(function(require, exports, module){
    //    var Swiper = require('Swiper');
    //    var swiper = new Swiper();
    //    //do something
    //});
</script>

##API

###Swiper([option])

option完整参数如下:

  • container:String,容器选择器,默认值.swiper

  • item:String,每一屏的选择器,默认值.item

  • direction:String,滑动方向,默认值vertical;横向滑动时为horizontal

  • activeClass: String,当前屏激活时添加的类名;默认值active

  • threshold:Number,滑动距离阀值,默认值50,当按住屏幕滑动超过此距离,松开手时,自动滑到下一屏,否则不滑动

  • duration:Number,滑屏动画时间,单位ms,默认值300;数值越小,滑动越快,越刺激

###事件

on

  • swiped:滑动结束时,触发swiped事件,回调函数传入两个参数,分别是上一屏和当前屏索引,从0算起。举例,从第一屏滑动到第二屏结束时:
    var swiper = new Swiper();
    swiper.on('swiped', function(prev, current){
        console.log('上一屏:', prev); // 0
        console.log('当前屏:', current); // 1
    });

方法

  • next: 主动滑动到下一屏。
    var swiper = new Swiper();
    swiper.next();
  • go: 主动滑动到指定界面。
    var swiper = new Swiper();
    swiper.go(1);

##License

swiper is available under the terms of the MIT License.

About

为移动端而生的滑动框架,无依赖,轻盈小巧,性能极致

wechatui.github.io/swiper/

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.