iPhone Web App - Stop body bounce/scrolling in iOS8

前端 未结 3 1047
时光说笑
时光说笑 2021-02-02 00:59

Yes, I know. This question has been asked a thousand times before. Thanks to all you guys, I was able to find a solution that finally did the job for me in <= iOS7. However,

3条回答
  •  囚心锁ツ
    2021-02-02 01:58

    This, combined with the fact that position: fixed gets respected more reliably, allows for some interesting effects. You could do a pull to refresh with a simple fixed 'underlay' that stays put while body is pulled down, thus revealing it.

    To answer your question:

    A touchmove handler that throws away ( event.preventDefault() ) the event if the following conditions are met should work:

    • The event is further up than the last one
    • The current target element and body are at scrollTop == 0
    • Same for the above two conditions to take care of bottom rubber pull (scrollTop + innerHeigh == scrollHeight)

    Please let me know if you're looking for a more detailled axplantion, happy to write it up.

提交回复
热议问题