Creating a “sticky” fixed-position item that works on iOS Safari

后端 未结 5 1837
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 08:40

On iOS safari, one-finger panning doesn’t generate any events until the user stops panning. An onscroll event is only generated when the page stops moving and redrawn.

5条回答
  •  忘掉有多难
    2020-12-08 09:02

    I've recently spent many hours trying to come up with a practical solution for the same problem. There's no right way to do this, although there are a few decent hacks (most of them mentioned already). The problem is that JavaScript is paused while the user is scrolling. It makes sense when you consider the implications, but it makes it damn hard to implement fixed positioned element.

    The best thing that I've been able to find is this wonderful post by the folks at Google. You can check out http://gmail.com in mobile safari to see it in action.

    https://developers.google.com/mobile/articles/webapp_fixed_ui

    Hope this helps.

提交回复
热议问题