Giter VIP home page Giter VIP logo

pull-to-reload's Introduction

โ˜๏ธ๐Ÿ‘‡ pull-to-reload

npm version MIT Licence

This is a pull to refresh implementation for the web. Designed to work with both mobile and desktop devices. Fits nicely with web-apps or single-page applications (SPA). Configurable to the seventh degree.

๐ŸŒตPreview

Functionality demo

Demo:

https://erlendellingsen.github.io/pull-to-reload/

Install

NPM (Recommended)

npm install pull-to-reload

Direct (Download)

Add pull-to-reload.js to your project.

๐ŸŒฟUsage

Quick example:

Html

<div id="ptr">
    ...
</div>

<div id="content">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores doloribus harum sed odit optio, fuga nam modi quod beatae? Tempore sunt molestiae, soluta quas unde exercitationem, modi accusamus pariatur reiciendis!
</div>

Javascript

$(document).ready(function(){
    var ptr = new PullToReload({ 
        'callback-loading': function(){
            setTimeout(function(){
                ptr.loadingEnd();
            }, 5000);
        }
    });
});

Available options:

this.opts = {
        'refresh-element': 'ptr', //Required
        'content-element': 'content', //Required
        'border-height': 1,
        'height': 80,
        'font-size': '30px',
        'threshold': 20,
        'pre-content': '...',
        'loading-content': 'Loading...',
        'callback-loading': function(){ setTimeout(function(){ self.loadingEnd(); }, 1000); } //Required
    }

๐Ÿ“Ž Dependencies

None ๐Ÿ”ฅ

๐Ÿฅ‡ Contributors

  • NathanHeffley (Removed jQuery dependency)
  • mdczaplicki (Minified version)

๐Ÿ’ช๐Ÿฝ Contribute

If you'd like to contribute to this project you can do so by creating a fork and send in a pull-request.

Make sure to write detailed comments and state your changes when sending in a PR. Keep the code style equal to the current.

Contributions are very much appreciated ๐Ÿ˜!

Topics where help is wanted/needed

  • Code: Making pull-to-reload not block regular scrolling functionality (e.g. in mobile apps).
  • Documentation/Wiki - Detailed how to/setup

License

As most of my other projects, this project is licensed as MIT.

pull-to-reload's People

Contributors

erlendellingsen avatar mdczaplicki avatar nathanheffley avatar theel0ja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pull-to-reload's Issues

Does not work with touch events

From my testing (which was not extensive but it was performed in emulation and on my real phone) the touch functionality of this script does not work, even with the jQuery version.

In my pull request to remove jQuery I just left out the touch events all together which is why you may not see the touch events if that's merged in by the time you read this.

npm import does nothing.

importing your package returns an empty object. nor can i use it because it does not set a global variable

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.