0

iPadのSafariブラウザで奇妙なエラーが発生しました。

これが私のコードです:

CSS:

#searchResults {
    border-style: none;
    background-color:#b00000;
    width:40%;    
    max-height:100%;    
    position:fixed;    
    left:40%;    
    overflow:hidden;    
    -webkit-overflow-scrolling:touch;    
    visibility:hidden;
}

HTML:

<button onClick = "buttonClick()"/>
<div id="searchResults">
    hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>hello<br>
</div>

JS:

function buttonClick() {
    document.getElementById('searchResults').style.visibility = "visible";
}

ポップアップdivコンテナはモバイルSafariでスクロールできませんが、visiblity:hidden部分を削除すると、正常にスクロールします。私は本当に可視性を排除することはできません:隠された部分、しかし私は何をすべきかわかりません。divをその場で動的に作成し、それが終わったら削除することもできますが、もっと簡単な方法があるはずです。

<ahref ="http://jsfiddle.net/sXj9m/58/"rel="nofollow">フィドルを参照

4

1 に答える 1

1

display: none;代わりに(hidden) とdisplay: block;(visible)を使用してみてください。

なぜそれが修正されるのかわかりませんが、うまくいくようです。

于 2012-07-28T02:58:44.060 に答える