All Projects → BoxFactura → Pulltorefresh.js

BoxFactura / Pulltorefresh.js

Licence: mit
A quick and powerful plugin for your pull-to-refresh needs in your webapp.

Programming Languages

javascript
184084 projects - #8 most used programming language
Pug
443 projects
Less
1899 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Pulltorefresh.js

Pulltozoominlistview
An Android custom ListView with pull to zoom-in and parallax effect header like Path App.
Stars: ✭ 891 (-76.64%)
Mutual labels:  pulltorefresh
Springview
🔥 A custom view pull to refresh,support ScrollView,ListView,RecyclerView,WebView and all another views, easy to use
Stars: ✭ 1,936 (-49.24%)
Mutual labels:  pulltorefresh
XCPullToLoadMoreListView
XCPullToLoadMoreListView-下拉加载更多ListView控件(仿QQ、微信聊天对话列表控件)
Stars: ✭ 24 (-99.37%)
Mutual labels:  pulltorefresh
Llmlistview
super list view for uwp
Stars: ✭ 27 (-99.29%)
Mutual labels:  pulltorefresh
Xrefreshlayout
【已过时,不再更新,请使用更强大的SmartRefreshLayout!】A refresh layout(无侵入下拉刷新和加载布局), can refresh RecyclerView for all LayoutManager, NestedScrollView。
Stars: ✭ 127 (-96.67%)
Mutual labels:  pulltorefresh
goRefresh
让下拉刷新炫酷起来~轻松接入lottie动画,支持listview recyclerview scrollerview webview 。同时支持listview和recyclerview上拉加载
Stars: ✭ 24 (-99.37%)
Mutual labels:  pulltorefresh
Smartrefreshlayout
🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。
Stars: ✭ 23,185 (+507.89%)
Mutual labels:  pulltorefresh
android-page
android 分页列表数据加载引擎,主要封装了android分页列表数据加载的各个组件,如果你有一个需要分页加载的List列表,都可以使用此框架实现。
Stars: ✭ 15 (-99.61%)
Mutual labels:  pulltorefresh
Xrefreshview
一个万能的android下拉上拉刷新的框架,完美支持recyclerview
Stars: ✭ 1,685 (-55.82%)
Mutual labels:  pulltorefresh
pulltorefresh
android pull to refresh library
Stars: ✭ 13 (-99.66%)
Mutual labels:  pulltorefresh
Pulltorefresh H5 Iscroll
基于IScroll5的PullToRefresh实现.。提供多套皮肤机制,便于拓展!
Stars: ✭ 56 (-98.53%)
Mutual labels:  pulltorefresh
Minirefresh
优雅的H5 下拉刷新。零依赖,高性能,多主题,易拓展。(A Graceful HTML5 Drop-Down-Refresh Plugin. )
Stars: ✭ 1,525 (-60.02%)
Mutual labels:  pulltorefresh
RNAndroidPullToRefresh
React Native 封装基于 Ultra-Pull-To-Refresh 的下拉刷新控件
Stars: ✭ 17 (-99.55%)
Mutual labels:  pulltorefresh
Pullrefresh
前端, 下拉刷新
Stars: ✭ 7 (-99.82%)
Mutual labels:  pulltorefresh
FlightBookingApp
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 26 (-99.32%)
Mutual labels:  pulltorefresh
Pullrefreshlayout
下拉刷新,上拉加载,真实的回弹(overscroll)效果(媲美qq),且大小只有37KB(是其他主流刷新库或回弹库的1/2,1/3,甚至是1/4),同时,自定义header和footer,可以实现任何你想的到的功能(例如:自动触发加载更多、二级刷新等)
Stars: ✭ 639 (-83.25%)
Mutual labels:  pulltorefresh
React Native Easy App
Simpler storage, Simpler fetch, Simpler UI
Stars: ✭ 214 (-94.39%)
Mutual labels:  pulltorefresh
PullToRefresh
下拉刷新库可自定义刷新加载
Stars: ✭ 111 (-97.09%)
Mutual labels:  pulltorefresh
AnimatedPullToRefresh-master
A Cool pull to refresh widget provided with character animation in header with user defined text. Customise your widget and show off your home screen!!
Stars: ✭ 38 (-99%)
Mutual labels:  pulltorefresh
PullToRefresh
A PullToRefresh widget.
Stars: ✭ 510 (-86.63%)
Mutual labels:  pulltorefresh

PulltoRefresh.js

Build Status NPM version CDNJS

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!


Donations

If you found this project useful, please consider making a donation.

Installation

Download PulltoRefresh either from the NPM Registry, CDNJS or UNPKG:

$ npm install pulltorefreshjs --save-dev
$ wget -O pulltorefresh.js https://unpkg.com/pulltorefreshjs

Include the JS file in your webapp and initialize it:

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

Bundlers can consume pulltorefreshjs as CommonJS and ES6-modules syntax:

import PullToRefresh from 'pulltorefreshjs';
// or
const PullToRefresh = require('pulltorefreshjs');

API

  • init(options) Will return a unique ptr-instance with a destroy() method.
  • destroyAll() Stop and remove all registered ptr-instances.
  • setPassiveMode(isPassive) Enable or disable passive mode for event handlers (new instances only).

Options

  • distThreshold (integer) Minimum distance required to trigger the refresh.
    — Defaults to 60
  • distMax (integer) Maximum distance possible for the element.
    — Defaults to 80
  • distReload (integer) After the distThreshold is reached and released, the element will have this height.
    — Defaults to 50
  • distIgnore (integer) After which distance should we start pulling?
    — Defaults to 0
  • mainElement (string) Before which element the pull to refresh elements will be?
    — Defaults to body
  • triggerElement (string) Which element should trigger the pull to refresh?
    — Defaults to body
  • ptrElement (string) Which class will the main element have?
    — Defaults to .ptr
  • classPrefix (string) Which class prefix for the elements?
    — Defaults to ptr--
  • cssProp (string) Which property will be used to calculate the element's proportions?
    — Defaults to min-height
  • iconArrow (string) The icon for both instructionsPullToRefresh and instructionsReleaseToRefresh
    — Defaults to ⇣
  • iconRefreshing (string) The icon when the refresh is in progress.
    — Defaults to …
  • instructionsPullToRefresh (string) The initial instructions string.
    — Defaults to Pull down to refresh
  • instructionsReleaseToRefresh (string) The instructions string when the distThreshold has been reached.
    — Defaults to Release to refresh
  • instructionsRefreshing (string) The refreshing text.
    — Defaults to Refreshing
  • refreshTimeout (integer) The delay, in milliseconds before the onRefresh is triggered.
    — Defaults to 500
  • getMarkup (function) It returns the default HTML for the widget, __PREFIX__ is replaced.
    — See src/lib/markup.js
  • getStyles (function) It returns the default CSS for the widget, __PREFIX__ is replaced.
    — See src/lib/styles.js
  • 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)
  • shouldPullToRefresh (function) Which condition should be met for pullToRefresh to trigger?
    — Defaults to !window.scrollY • Please note that this default is useful whenever you're setting mainElement as the body of the document, if you need it in another element with overflow, use !this.mainElement.scrollTop. Refer to the multiple instances demo for reference.

Use with React

With ReactDOMServer and renderToString() you can use components as icons instead of just strings. In this example we also use Font Awesome to get nice icons with animation, but you can use any React component you like.

Demo on codesandbox.io

import React, { Component } from 'react';
import ReactDOMServer from 'react-dom/server';
import PullToRefresh from 'pulltorefreshjs';
import { faSyncAlt} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

class App extends Component
{
    componentDidMount()
    {
        PullToRefresh.init({
            mainElement: 'body',
            onRefresh() {
                window.location.reload();
            },
            iconArrow: ReactDOMServer.renderToString(
                <FontAwesomeIcon icon={faSyncAlt} />
            ),
            iconRefreshing: ReactDOMServer.renderToString(
                <FontAwesomeIcon icon={faSyncAlt} spin={true} />
            ),
        });
    }

    componentWillUnmount()
    {
        // Don't forget to destroy all instances on unmout
        // or you will get some glitches.
        PullToRefresh.destroyAll();
    }

    render()
    {
        return (
            <div>
                <h1>App</h1>
            </div>
        );
    }
}

export default App;

Contribute

To quickly start the development workflow:

  1. Install NodeJS (NVM)
  2. Run nvm use 10 && npm install
  3. Then npm run dev

This will watch and compile the bundle for browser usage.

E2E tests are executed with Testcafé.

  • Run npm test to fire tests in the default browser, use BROWSER to change this
  • ...or just run make to setup the dependencies and run tests only (e.g. CI)

Advanced debug can be achieved with testcafe-live, e.g.

$ npm test --live chrome tests/e2e/cases --debug-on-fail

Roadmap

  • More events: onPullStart, onPullDown(direction, willRefresh), onRelease(willRefresh)
  • Fully customizable CSS
  • Gallery of use cases
  • Advanced demos
  • Tests
  • Minified releases
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].