当有30多个项目时,Iscroll很慢并且不会顺利移动

时间:2013-05-21 10:47:12

标签: javascript iscroll4

当我的iscroll中有更多项目(如30)时,移动设备上的iscroll插件变得非常慢(我认为它是因为有一些不必要的颜料或者我的手机速度慢了吗?)并且它不会顺利移动。

http://www.html5rocks.com/en/tutorials/speed/unnecessary-paints/ 您对其他插件有什么建议或如何解决这个问题吗?

我正在使用handelbars来呈现它。但是html结构看起来像这样:

<div id="notificationsScroll">
    <div id="notificationList" class="friends-tiles">
      <div class="smooth friend">

       </div>
    </div>
</div>

和css看起来像这样

#notificationsScroll{
    position:relative;
    z-index:1;
    width: auto;/* your desired width, auto and 100% are fine */;
    height: 73%;
    //height: 334px;/* element height */;
    overflow: scroll;
}

我正在使用iScroll v4.1.6

1 个答案:

答案 0 :(得分:1)

您的代码段并未显示您已应用iScroll - 这可能是对代码进行粘贴的疏忽,或者可能是问题... iscroll会覆盖原生滚动,这在历史上是缓慢且不直观的触摸界面(至少在iPhone上!)。你在JS中初始化iScroll吗?

var myScroll;
function loaded() {
    myScroll = new iScroll('notificationsScroll');
}
document.addEventListener('DOMContentLoaded', loaded, false);