- Overview
- Documents
pull2refresh.js is a jQuery plugin that provides pull to refresh functionality for web pages, as you seen in most mobile APPs. Supports drag event on desktop and touch event on mobile.
Source: github.com
May 24, 2014 in Drag and drop 9466 views
pull2refresh.js is a jQuery plugin that provides pull to refresh functionality for web pages, as you seen in most mobile APPs. Supports drag event on desktop and touch event on mobile.
Source: github.com
1. INCLUDE JS AND CSS FILES
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script src="../js/jquery.ui.touch-punch.min.js"></script> <script src="../js/jquery.velocity.min.js"></script> <script src="jquery.pull2refresh.js"></script> <link rel="stylesheet" href="../jquery.pull2refresh.css" type="text/css"/>
2. HTML
<div id="content"></div>
Wrap your main content in a wrapper element
3. JAVASCRIPT
$("#content").pull2refresh('init', { loaderImage: "images/loader.gif", /* optional */ loaderClass: "pull2refresh-loader", /* optional */ triggerAtY: 200, /* optional */ start: function() { asyncFunction(function() { $("#content").pull2refresh('hide'); }) } }); function asyncFunction(callback) { setTimeout(function() { callback(); }, 1000) }
Tagged with:
pull2refresh
pull down to refresh
pull to refresh
drag event
drag to refresh
touch event
mobile
Related Articles