Giter Site home page Giter Site logo

pulltorefresh's Introduction

pullToRefresh

基于mui整页滚动的下拉刷新和上拉加载

引入

<link rel="stylesheet" href="css/mui.css">
<link rel="stylesheet" type="text/css" href="css/pullToRefresh.min.css" />
<script src="js/jquery.js"></script>
<script src="js/pullToRefresh.js"></script>

初始化

var refresh = new Refresh('.mui-content');

设置下拉刷新状态

refresh.pullToRefresh.type = 'start';//start:加载前;loading:加载中;

设置上拉加载状态

refresh.pullToLoadMore.type = 'start';//start:加载前;loading:加载中;end:没有更多数据;none:不显示

下拉刷新事件

refresh.onPullToRefresh = function() {}

上拉加载事件

refresh.onPullToLoadMore = function() {}

滚动到(只支持y轴滚动)

refresh.scrollTo(x,y,t);//x:x轴位置,y:y轴位置(不带单位),t,滚动的总时间(毫秒)

其他事件方法

  • 监听事件:on
  • 取消监听:off

on方法支持的事件列表

  • beforeScrollStart 滚动开始前
  • scrollStart 滚动开始
  • scroll 滚动中
  • scrollEnd滚动结束
refresh.on('scroll',function(){
  console.log('滚动中');
});

pulltorefresh's People

Contributors

zhetengbiji avatar

Stargazers

LonLoc avatar Snailcctw avatar wangkunpeng avatar

Watchers

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