[ 中文 ]
Pull to refresh
Pull to refresh control for mobile web. Small and no dependencies.
Previews
You can checkout the demos in Chrome mobile, Safari mobile, or toggle the device simulator on in Chrome DevTools.
Material style:
![Material style](https://github.com/jiangfengming/pull-to-refresh/raw/HEAD/imgs/material.gif)
Material style - colorful:
![Material style - colorful](https://github.com/jiangfengming/pull-to-refresh/raw/HEAD/imgs/material-colorful.gif)
Material style 2:
![Material style 2](https://github.com/jiangfengming/pull-to-refresh/raw/HEAD/imgs/material2.gif)
Material style 2 - colorful:
![Material style 2 - colorful](https://github.com/jiangfengming/pull-to-refresh/raw/HEAD/imgs/material2-colorful.gif)
iOS style:
![iOS style](https://github.com/jiangfengming/pull-to-refresh/raw/HEAD/imgs/ios.gif)
How to use
Installing
npm install mobile-pull-to-refresh --save
Including JS and CSS (webpack)
import pullToRefresh from 'mobile-pull-to-refresh'
import ptrAnimatesMaterial from 'mobile-pull-to-refresh/dist/styles/material/animates'
import 'mobile-pull-to-refresh/dist/styles/material/style.css'
import ptrAnimatesMaterial2 from 'mobile-pull-to-refresh/dist/styles/material2/animates'
import 'mobile-pull-to-refresh/dist/styles/material2/style.css'
import ptrAnimatesIos from 'mobile-pull-to-refresh/dist/styles/ios/animates'
import 'mobile-pull-to-refresh/dist/styles/ios/style.css'
HTML snippets
Please checkout the example html files:
Invoking
const destroyCb = pullToRefresh({
container: document.querySelector('.container'),
animates: ptrAnimatesMaterial,
refresh() {
return new Promise(resolve => {
setTimeout(resolve, 2000)
})
}
})
License
MIT
Credit to