jordansinger / Hook

Pull to refresh for the web
MIT License
1.6k stars 280 forks source link

iOS 7 (maybe all) Doesn't work unless you scroll from the very top #19

Open marcmedina opened 10 years ago

marcmedina commented 10 years ago

It seems using the newest version, I could not get this to fire. Then I tried pulling from the top of the browser (right below the address bar) and it works. Very strange, I tried with a previous version of Hook and it works like intended. Perhaps the is a bug in the latest version?

I have a basic bootstrap page up with hook (http://medinastudios.com/test/)

Trying pulling it down, it only seems to work when you pull next to the top nav bar.

brandonjacoby commented 10 years ago

This is possibly a bug having to do with Bootstrap, I tested it on a few other sites, and it works as planned. I will look into this.

marcmedina commented 10 years ago

It could be. It works as intended when I grabbed an older version of hook (specifically using the source on gethook.com) FYI.

malteriechmann commented 10 years ago

@marcmedina which one worked for you?

I have the same problem without using bootstrap.

SamMauldin commented 10 years ago

I have the same problem with uikit

jpfranco commented 10 years ago

I had the same issue and I think that I managed to fix it by doing the following changes:

          addHandler('touchmove', function(e) {
            // Should substract instead of adding
            //swipe = e.originalEvent.touches[0].pageY + lastY;
            swipe = e.originalEvent.touches[0].pageY - lastY;
            st = $(this).scrollTop();

            // This prevents the user from swiping down
            /*if(swipe < settings.swipeDistance) {
              e.preventDefault();
            }*/

            // Second condition prevents swipe from anywhere
            // below the first 40 pixels
            if(swipe > settings.swipeDistance /*&& lastY <= 40*/) {
              methods.onSwipe($this, settings);
            }
          });

I'm not sure whether removing those lines breaks another part of the functionality that I'm missing, but at least it seems to let you swipe from anywhere on the screen.