GithubHelp home page GithubHelp logo

apeatling / web-pull-to-refresh Goto Github PK

View Code? Open in Web Editor NEW
545.0 11.0 93.0 115 KB

A native-like JavaScript pull to refresh implementation for the web.

Home Page: https://apeatling.com/articles/javascript-pull-to-refresh-web/

License: MIT License

CSS 25.48% HTML 17.05% JavaScript 57.47%
pull-to-refresh pulltorefresh javascript web app

web-pull-to-refresh's People

Contributors

apeatling 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

web-pull-to-refresh's Issues

publish web-pull-to-refresh npm module

WPTR is the nicest implementation I've seen so far of pull-to-refresh. I think if you published an npm module, lots of developers would happily drop this in to their app. Including me!

not working with the new version of hammer js

Hi,

I love the demo and it is works great! But when I am trying to integrate the code to my site, I found it is not working with the new version of the hammer js. (v2.0.4)

is it possible to work with the new version?

Plz advise.

thx.

HammerJS.get() call seems to break vertical scrolling

If you have a content element that extends past the bottom of the screen and use WPTR, the user can no longer drag to scroll the page. I was able to isolate the problem to this call to HammerJS in init():
h.get( 'pan' ).set( { direction: Hammer.DIRECTION_VERTICAL } );

I tried commenting that line out, and everything else in WPTR seems to work just fine in my app. Happy to send you a PR to delete that line if you think there are no unintended side effects.

Demo doesn't work on Windows Phone

Works a treat in Chrome on my desktop, but in testing on Windows Phone, this doesn't work, any ideas why this might be? Happy to work with you to get this working.

Where do i add in the optional parameters??

I am not sure where do i change these, if i change the contentEI inside the wptr.1.1.js then the "animation" part stopped working.

{
    // ID of the element holding dragable content area
    contentEl: 'content', 

    // ID of the element holding pull to refresh loading area
    ptrEl: 'ptr', 

    // Number of pixels of dragging down until refresh will fire
    distanceToRefresh: 70, 

  // The dragging resistance level, the higher the more you'll need to drag down.
  resistance: 2.5
}

ptrEl and contentEl options expecting elements, not IDs

According to the documentation, the ptrEl and contentEl options are the IDs of those respective elements. However, the code does not use them as IDs: it never passes them into, say, document.getElementId to fetch the actual elements. This has the side effect of causing Hammer to throw an exception if these parameters are used.

There are two options here: pass in the elements directly (which does not require a code change but might be kind of wonky) or update the code to make sure we're getting elements back. I'll attach a pull request for the latter.

Library not on Bower

Please consider publishing this library on Bower so managing it's version and dependencies is easier ;)

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.