我找到了许多相关问题,但没有一个答案解释如何在iOS 4中使用双指方法滚动
我可以通过设置
iframe
。我可以通过设置
width
和height
属性并设置overflow: scroll;
来用双指滚动div
。以下是更完整的示例:<div style='width: 280px; height: 200px; overflow: scroll; -webkit-overflow-scrolling: touch;'>
Just imagine a bunch of content is in here, spanning well over 200px
worth of height. You can scroll this just fine in iOS 4 by using 2
fingers, or in iOS 5 by swiping 1 finger thanks to
"-webkit-overflow-scrolling: touch;".
</div>
在我的运行iOS 4.3的iPad 1上,这种方法对于iframes
不起作用。以下是一个完整的示例,在iOS 4中无论使用哪种手指组合都无法滚动(尽管当然,-webkit-overflow-scrolling
使其可以在iOS 5上工作):
<html>
<head>
<style type="text/css">
#scroller {
width: 280px;
height: 200px;
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
#scroller iframe {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="scroller">
<iframe src="content.html">content.html is a big list of nonsense.</iframe>
</div>
</body>
</html>
需要强调的是,如果我将iframe
的width
和height
设置为像素值,例如 height: 1000px;
,我则可以通过两根手指滑动来进行操作,但是我永远无法知道iframe的内容有多高。所以,也许真正的问题是如何说服iOS 4上的移动Safari相信这个div
内部的iframe
确实大于280x200像素?