防止在 Windows Phone 8 的 Cordova 中滚动出 CordovaView [英] Prevent scrolling out of CordovaView in Cordova for Windows Phone 8
问题描述
在 Windows Phone 8 Cordova 应用程序中,我可以在应用程序中单击并水平拖动,然后平移/滚动经过显示屏的水平边缘.查看 Cordova Windows Phone 8 独立模板应用程序:
In a Windows Phone 8 Cordova application I'm able to click and drag horizontally in the app and pan/scroll past the horizontal edge of the display. See the Cordova Windows Phone 8 standalone template application:
就我所见,此模板应用程序背后的 HTML 具有适当的视口规范:
The HTML behind this template application has a proper viewport specification, as far as I can see:
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
此错误使任何类型的滑动手势检测无效.iOS UIScrollView 控件有一个 bounces
属性 允许取消一些类似的效果.
This bug prevents any kind of swipe gesture detection from being useful. The iOS UIScrollView control has a bounces
property that allows a somewhat similar effect to be canceled.
这是 Cordova 错误吗?是否有一些设置可以放置在 Cordova WebBrowser 的容器上,从而不会发生这种平移?
Is this a Cordova bug? Is there some setting that can be placed on the container of the Cordova WebBrowser such that this panning can't happen?
推荐答案
body
标签上的两个额外 CSS 属性修复了独立模板应用程序和我正在使用的原始应用程序中的平移问题在:
Two extra CSS properties on the body
tag fixed the panning problem in both the standalone template app and in the original app I was working on:
body {
overflow: hidden;
-ms-content-zooming: none; }
这个 ms-content-zooming
属性不限制在作为 body
元素的子元素的元素内垂直滚动.
This ms-content-zooming
property does not restrict vertical scrolling within elements that are children of the body
element.
这篇关于防止在 Windows Phone 8 的 Cordova 中滚动出 CordovaView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!