如何从Phonegap应用程序的顶部停止屏幕滚动?

时间:2012-01-23 15:54:52

标签: css cordova scroll zepto

我目前正在使用Phonegap进行开发。它工作正常,除了顶部有一个小的(~1像素)条,触摸这将导致整个应用程序滚动,这是我不想要的。这是我用来阻止应用程序其余部分滚动的内容:

<div id="container" ontouchstart="stopIt(event, true);" ontouchmove="stopIt(event, true);" ontouchend="stopIt(event, false);">

stopIt = function(event, touching)
{
    event.preventDefailt();
    //Other code
}

CSS:

#container {
  width:100%;
  height:100%;
}

有谁知道可能导致这种情况的原因,或者如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我认为你在谈论iPhone顶部的状态栏?是的,它将始终滚动到顶部,并且无法捕获此事件并将其从浏览器中停止。

您需要将原始端的Web视图的scrollToTop属性设置为false。这应该有用。

[theWebView setScrollsToTop:NO];