Pull-To-Refresh Needs In Your Web App | pulltorefresh.js

pulltorefresh.js is a small, but powerful JS library designed to pull the refresh feature of your web app and add pull to refresh (swipe) for your webpages using pure JavaScript.

[jQuery] Add Image Cropper With Upload to Your Web Application

How to make use of it:

Download and embrace the pulltorefresh.js in your webpage.

<script src="pulltorefresh.js"></script>

Initialize the PullToRefresh with some choices.

  mainElement: '#main',
  onRefresh: function() { alert('refresh') }

Customize the set of components.

  mainElement: '#main',
  triggerElement: '.trigger',
  onRefresh: function() { alert('refresh') }

Promise help:

  mainElement: '#main', // above which element?
  onRefresh: function(){
    var promise = new Promise(
      function(resolve, reject){
        }, 1500);
    return promise;

All default choices.

// Minimum distance required to trigger the refresh
distTreshold: 60,

// Maximum distance possible for the element
distMax: 80,

// After the distTreshold is reached and released, the element will have this height
distReload: 50,

bodyOffset: 20,

// Before which element the pull to refresh elements will be
mainElement: 'body',

// Which element should trigger the pull to refresh
triggerElement: 'body',

// What class will the main element have?
ptrElement: '.ptr',

// What class prefix for the elements?
classPrefix: 'ptr--',

// What property will be used to calculate the element's proportions?
cssProp: 'min-height',

// The icon for both instructionsPullToRefresh and instructionsReleaseToRefresh
iconArrow: '&#8675;',

// The icon when the refresh is in progress.
iconRefreshing: '&hellip;',

// The initial instructions string.
instructionsPullToRefresh: 'Pull down to refresh',

// The instructions string when the distTreshold has been reached.
instructionsReleaseToRefresh: 'Release to refresh',

// The refreshing text.
instructionsRefreshing: 'Refreshing',

// The delay, in milliseconds before the onRefresh is triggered.
refreshTimeout: 500,

// The initialize function.
onInit: function () {},

// What will the pull to refresh trigger? You can return a promise. 
onRefresh: function () { return location.reload(); },

// The resistance function, accepts one parameter, must return a number, capping at 1.
resistanceFunction: function (t) { return Math.min(1, t / 2.5); },

// Which condition should be met for pullToRefresh to trigger?
shouldPullToRefresh: function () { return !window.scrollY; }

Easy Pull To Refresh Library, pulltorefresh js Plugin/Github


See Demo And Download

Official Website(BoxFactura): Click Here

This superior jQuery/javascript plugin is developed by BoxFactura. For extra Advanced Usages, please go to the official website.

Related Posts


Adding Zoom-on-Wheel and Pan-on-Drag to Inline SVG Elements

Vanilla-js module for adding zoom and panning behavior when dragging to SVG embedded elements. A lightweight Vanilla JavaScript plugin that enables zoom and pan functions on an…


Sorting HTML Table Vanilla JavaScript Library | Sortable.js

Sortable – Small JS vanilla table sorter makes any table with class = “sortable“, er, sortable. That is, the user can click the table header and change…


WYSIWYG Rich Text Editor With jQuery And FontAwesome | RichText

RichText jQuery implementation for WYSIWYG Rich Text Editor which uses Font Awesome Iconic Font for editor icons. It is licensed under AGPL-3.0. Initialize editor Simply call .richText() on your jQuery(‘textarea’) or jQuery(‘input’)…


[Autocomplete] Email Domain Suggestions Like Gmail, Outlook, or More | email-genie

Email Genie allows auto-completion in the email field by providing a list of domain suggestions (gmail.com, outlook.com, etc.). This package is lightweight, flexible, compatible with libraries (jQuery,…


[Generator] JavaScript Library for Creating Squircley Magic ✨ | squircley.js

squircley.js is the core magic of Squirclular ✨ from https://squircley.app wrapped in a simple 0-dependency JavaScript library. squircley.js can generate SVG files, add square backgrounds to DOM…