Giter Club home page Giter Club logo

pulltorefresh.js's Introduction

PulltoRefresh.js

PulltoRefresh.jsDemos

A small, but powerful Javascript library crafted to power your webapp's pull to refresh feature. No markup needed, highly customizable and dependency-free!


Install

Include the JS file in your webapp and initialize it:

PullToRefresh.init({
  mainElement: 'body',
  onRefresh: function(){ window.location.reload(); }
});

API

distThreshold (integer, default: 60)

Minimum distance required to trigger the refresh.

distMax (integer, default: 80)

Maximum distance possible for the element.

distReload (integer, default: 50)

After the distThreshold is reached and released, the element will have this height.

mainElement (string, default: body)

Before which element the pull to refresh elements will be?

triggerElement (string, default: body)

Which element should trigger the pull to refresh?

ptrElement (string, default: .ptr)

What class will the main element have?

classPrefix (string, default: ptr--)

What class prefix for the elements?

cssProp (string, default: min-height)

What property will be used to calculate the element's proportions?

iconArrow (string, default: ⇣)

The icon for both instructionsPullToRefresh and instructionsReleaseToRefresh

iconRefreshing (string, default: …)

The icon when the refresh is in progress.

instructionsPullToRefresh (string, default: Pull down to refresh)

The initial instructions string.

instructionsReleaseToRefresh (string, default: Release to refresh)

The instructions string when the distThreshold has been reached.

instructionsRefreshing (string, default: Refreshing)

The refreshing text.

refreshTimeout (integer, default: 500)

The delay, in milliseconds before the onRefresh is triggered.

onInit (function)

The initialize function.

onRefresh (function)

What will the pull to refresh trigger? You can return a promise. Defaults to window.location.reload()

resistanceFunction (function)

The resistance function, accepts one parameter, must return a number, capping at 1. Defaults to t => Math.min(1, t / 2.5)

Contribute

  1. Install yarn
  2. Run yarn
  3. Then yarn dev

pulltorefresh.js's People

Contributors

pateketrueke avatar uzitech avatar

Watchers

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