Giter Club home page Giter Club logo

pullrefresh's Introduction

pullRefresh 下拉刷新组件

适用于移动端纵向下拉刷新,通过对外暴露相应的事件完成相应的切换逻辑

###对外事件

@customEvent canPullDownMove touchmove时触发,此时可处理下拉时Loading状态
@customEvent clearPullDownMove touchend时触发,介于canPullDownMove与canPullDownRefresh之间,可用于取消loading状态
@customEvent canPullDownRefresh touchend时触发,所有状态准备完毕,可请求新数据

###使用

var pullRefreshIns = new pullRefresh({
    el: $( document.body ), //绑定事件的dom元素 id或jq对象
    offsetScrollTop: 2,     //滚动条偏移值,大于此值不触发下拉事件
    offsetY: 75             //触摸起止Y偏移值,大于些值才会触发下拉事件
});

$.bind(pullRefreshIns, 'canPullDownMove', function() {
    //此时可处理下拉时Loading状态
});

$.bind(pullRefreshIns, 'clearPullDownMove', function() {
    //此时可处理清除下拉loading状态
});

$.bind(pullRefreshIns, 'canPullDownRefresh', function() {
    //所有状态准备完毕,可请求新数据
});

###demo 扫描以下二维码手机体验 demo

pullrefresh's People

Contributors

zhangchen2397 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.