1

我正在使用 jQuery Mobile 来建立一个移动网站。在一个页面上,我有一堆文本要显示在一个 div 中。我根据iScroll 4 的简单示例进行编码

我在我的 Chrome 浏览器中得到了它,但是当我在移动 safari 中测试它时,我可以稍微向下滑动文本,但它会弹回,而不是向下滚动。

这是 HTML 标记:

<div data-role="content">       
        <div class="text-content-wrapper">
            <div id="scroll-wrapper">
                <ul>
                    <li>Content</li>
                    <li>Content</li>
                    <li>Content</li>
                    <li>Content</li>
                </ul>
            </div>
        </div>

CSS是:

.text-content-wrapper {
width: 80%;
height: 240px;
position: absolute;
left: 35px;
top: 65px;
overflow: auto;
padding: 10px 0;
background-color: white;
opacity: 0.8;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
z-index: 1;
}

#scroll-wrapper ul{
position: absolute;
z-index: 1;
width: 100%;
list-style: none;
text-align: left;
height: 360px;
}

如果我将位置:绝对移动到#scroll-wrapper,它甚至无法在 chrome 中工作。

并使用 iScroll:

var myScroll1;
function loaded() {
myScroll1 = new iScroll('scroll-wrapper');
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
4

0 回答 0