ja faktycznie mający dokładnie ten sam problem. Zawęziłem to do faktu, że wpływa na DIV, których treść nie wymaga już przewijania, gdy orientacja jest zmieniona.
W twoim przykładzie. DIV z prawej strony przewija się w pejzażu, NIE POTRZEBUJE przewijać portretu, ale potem musi przewijać ponownie. Przetestowałem to, gdy oba DIV (lewy i prawy) muszą przewijać niezależnie od orientacji i nie stanowi to problemu.
AKTUALIZACJA:
Rzeczywiście, naprawiłem to!
Problem wydaje się być problemem z czasem. Podczas zmiany rozmiaru wewnętrzna zawartość nie jest wystarczająco duża, aby zapewnić przewijanie na zewnętrznym DIV, który ma przepełnienie. Po marnować dzień na to, w końcu wpadł na ten Hack:
<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>
Oto moja logika, gdy strona zmienia rozmiar:
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);
}
Całkowicie zapomniałem o tym pytaniu, tak naprawdę znalazłem to samo, z takim samym rozwiązaniem jak ty. Powinienem był umieścić kod z powrotem tutaj, zaoszczędziłem ci trochę czasu, oops! Dzięki jednak :) – will
Znaleźć inny sposób, jeśli ktoś jest zainteresowany ... Wszelkie komentarze mile widziane. Zobacz poniżej. –
To naprawdę działa świetnie. Szkoda, że błąd musi tam być. –