首页 > 移动平台 > 详细

移动端web页面滚动不流畅,卡顿闪烁解决方案

时间:2017-11-18 18:21:34      阅读:420      评论:0      收藏:0      [点我收藏+]

1.ios端的-webkit-overflow-scrolling属性可控制页面滚动效果,设置如下实现惯性滚动和弹性效果:

-webkit-overflow-scrolling: touch

2.position属性导致的页面滚动不流畅问题:

<div style="overflow-x: hidden; overflow-y: auto; position: absolute; height: 200px;">
    <div style="position: relative; height: 200px;"></div>
    <div style="position: relative; height: 200px;"></div>
    <div style="position: relative; height: 200px;"></div>
</div>

如上代码所示,当absolute定位的容器内存在relative定位并且高度大于外置容器时,容器的滚动会出现卡顿闪烁现象,解决方法如下所示:

<div style="overflow-x: hidden; overflow-y: auto; position: absolute; height: 200px;">
    <div style="position: absolute; top: 0; left: 0;">
        <div style="position: relative; height: 200px;"></div>
        <div style="position: relative; height: 200px;"></div>
        <div style="position: relative; height: 200px;"></div>
    </div>
</div>

可以用一个absolute容器将内部relative元素包裹起来,便可解决滚动闪烁问题。

 

移动端web页面滚动不流畅,卡顿闪烁解决方案

原文:http://www.cnblogs.com/mousea/p/7857507.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!