问题描述
在试图找出UIWebView的滚动位置时,我在HTML中附加了一个监听器,它将回调主应用程序。我附加了javascript监听器,如:
In trying to figure out the scroll position for a UIWebView, I'm attaching a listener in the HTML that will call back to the main app. I attach the javascript listener like:
window.onscroll = function reportScroll() {
var sY = window.pageYOffset;
alert('Scroll pos: '+sY); // Would evetually trigger a URL or something
}
这个事件似乎只是触发了一旦减速结束,在OS 3.2(iPad)上轻弹滚动结束时。但是这样:似乎表示它应该在单个手指平底锅的末端触发。我真的需要知道那个锅何时完成。
This event only seems to be triggered at the end of a flick scroll on OS 3.2 (iPad), once the deceleration has ended. However this: https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW7 seems to indicate that it should be triggered at the end of a single finger pan as well. I really need to know when that pan completes as well.
推荐答案
根据 Safari iPhone不会在窗口
上触发 onscroll
事件,但是而是在文档
(和任何其他元素)。我敢打赌Safari iPad会做同样的事情。
According to QuirksMode Safari iPhone doesn't fire onscroll
event on window
, but rather on the document
(and any other element). I would bet Safari iPad does the same thing.
这篇关于单点触控后没有在iPad上触发onscroll事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!