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 中滚动,但如果我消除了可见性:隐藏部分,那么它滚动就好了。我真的无法消除可见性:隐藏部分,但我不知道该怎么做。我可以动态创建 div,然后在完成后将其删除,但似乎应该有一个更简单的方法。

​​<a href="http://jsfiddle.net/sXj9m/58/" rel="nofollow">见小提琴

4

1 回答 1

1

尝试使用display: none;(hidden) 和display: block;(visible) 代替。

我不知道为什么会解决它,但它似乎可以解决问题。

于 2012-07-28T02:58:44.060 回答