美文网首页
ios内部滚动不顺畅卡顿

ios内部滚动不顺畅卡顿

作者: 有田春雪 | 来源:发表于2018-04-08 17:49 被阅读0次

ios内部滚动不顺畅卡顿解决方案

常见的方案是 -webkit-overflow-scrolling: touch; 其可实现惯性滚动和弹性效果

定位造成的滚动不顺畅

// 当absolute定位的容器内存在relative定位并且高度大于外置容器时,容器的滚动会出现卡顿闪烁现象
<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>

// 解决方案 => 加一层包裹起来
<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>

参考文章

相关文章

网友评论

      本文标题:ios内部滚动不顺畅卡顿

      本文链接:https://www.haomeiwen.com/subject/onjmhftx.html