npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iswiper

v1.4.1

Published

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

Downloads

11

Readme

##swiper

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

体验

扫描二维码

demo

http://wechatui.github.io/swiper

##安装

##用法

<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也支持AMDCMD规范,可以用requirejsseajs进行加载。

<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.