无法让iScroll使用jQuery Mobile正确滚动div

时间:2012-02-09 11:14:04

标签: jquery-mobile mobile-safari mobile-website iscroll4

我正在使用jQuery Mobile构建移动网站。 在一个页面上,我有一堆文本显示在div中。 我根据the simple example of 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;
}

如果我将位置:绝对移动到#roll-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);

0 个答案:

没有答案
相关问题