我想在 HTML 页面中获得与 ios google chrome 的标题类似的行为:当用户开始滚动到页面顶部(从页面的任何位置)时,页面标题看起来好像只是坐着多于。当用户滚动到底部时 - 标题只是保持其位置并向上滑动。
我添加了一个“touchmove”事件来捕获滚动坐标,并且可以将其记录在某个 div 中以检查它是否正常工作并且看起来工作正常,除了标题的位置在滚动时没有更新。一旦滚动停止,标题的位置就会按预期更新。
所以我的问题是:是否可以在用户滚动时更新元素?
我宁愿不更改为滚动元素的内容(而不是滚动页面本身)。
似乎没有解决方法,来自 Jquery.mobile 页面:
Triggers when a scroll begins. Note that iOS devices freeze DOM manipulation during scroll, queuing them to apply when the scroll finishes. We're currently investigating ways to allow DOM manipulations to apply before a scroll starts.
最佳答案
关于css - 滚动时 iOS Safari 更新元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21127321/