其实我有完全相同的问题。我已经缩小了它的范围,它影响了在方向改变时内容不再需要滚动的DIV。
在你的例子中。右侧的DIV在横向滚动,不需要纵向滚动,但需要再次滚动。我已经测试过这两个DIV(左和右)需要滚动而不管方向和它不是问题。
更新:
我其实似乎已经修好了!
这个问题似乎是一个计时问题。在调整大小的过程中,内容不够大,不足以保证在溢出的外部DIV上滚动。在这浪费了一天之后,我终于想出了这个技巧:
<div id="header" style="position:fixed; height:100px">Header</div>
<div id="content" style="overflow: auto; -webkit-overflow-scrolling: touch">
<div id="contentInner">
content that is not long enough to always scroll during different orientations
</div>
</div>
这里是我的逻辑,只要在网页调整大小:
function handleResize()
{
var iHeight = $(window).height() - $("#header").height();
// Height needs to be set, to allow for scrolling -
//this is the fixed container that will scroll
$('#content').height(iHeight - 10);
// Temporarily blow out the inner content, to FORCE ipad to scroll during resizing
// This is a timing issue where the inner content is not big enough during resize post orientation to require the outer DIV to scroll
$('#contentInner').height(1000);
// Set the heights back to something normal
// We have to "pause" long enough for the re-orientation resize to finish
window.setTimeout(delayFix, 10);
}
function delayFix()
{
var iHeight = $(window).height() - $("#header").height();
// Inner divs force the outer div to always have at least something to scroll. This makes the inner DIV always "rubber-band" and prevents
// the page from scrolling all over the place for no reason.
// The height of the inner guy needs to be AT LEAST as big as the container and actually a nip bigger to cause the
// scrollable area to 'rubber band' properly
$('#contentInner').height(iHeight + 20);
}
我完全忘了这个问题,实际上我最终还是把它弄清楚了,用完全相同的解决方案。我应该把代码备份到这里,节省了一些时间,哎呀!谢谢虽然:) – will 2012-05-11 08:49:29
找到另一种方式,如果任何人有兴趣...任何意见欢迎。见下文。 – 2012-09-18 13:10:14
这真的很好。太糟糕了,故障必须首先出现在那里。 – 2014-01-18 09:07:06