创建“粘性”适用于iOS Safari的固定位置项 [英] Creating a "sticky" fixed-position item that works on iOS Safari
问题描述
在iOS Safari中,单指平移在用户停止平移之前不会生成任何事件。仅当页面停止移动并重新绘制时才会生成onscroll事件。
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.
我需要一种方法来检测实时滚动。具体来说,我想制作一个也适用于iOS Safari的粘性菜单。在非移动浏览器上,粘贴菜单可以通过在听取onscroll事件时在元素上的position relative到position fixed之间切换来完成。此方法不适用于移动浏览器,因为不会连续触发onscroll事件。我该怎么办?
I need a way to detect real time scrolling. Specifically, I want to make a sticky menu that will also work on iOS safari. On non-mobile browsers, sticky menu can be done by switching between "position relative" to "position fixed" on the element while listening to the onscroll events. This method won't work on mobile browser because onscroll events are not continuously fired. What can I do?
推荐答案
回答我自己的问题。 iOS7现在支持位置:粘性
演示: http://html5-demos.appspot.com/ static / css / sticky.html
Answering my own question. iOS7 now support position:sticky Demo: http://html5-demos.appspot.com/static/css/sticky.html
这篇关于创建“粘性”适用于iOS Safari的固定位置项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!