记一个ios滚动穿透问题

直接上代码

<body style="overflow: hidden;-webkit-overflow-scrolling: touch;">

    <div id="view" style="position: relative;">
        <div id="scrollview" style="position: absolute;top: 0;bottom: 0;left: 0; width: 100%;background: #f7f7f7;overflow: auto;">
            <div style="background-color: red;width: 50px;height: 300px;">1</div>
            <div style="background-color: gray;width: 50px;height: 300px;">2</div>
            <div style="background-color: green;width: 50px;height: 300px;">3</div>
        </div>
    </div>

    <div id="model" style="position: fixed;bottom: 0; height: 300px;left: 0;width: 100%; background-color: gold;overflow: auto;z-index: 10;-webkit-overflow-scrolling: auto;">
        <div style="background-color: skyblue;width: 100px;height: 300px;">1</div>
        <div style="background-color: gray;width: 100px;height: 300px;">2</div>
        <div style="background-color: green;width: 100px;height: 300px;">3</div>
    </div>

</body>
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script>
    $('#view').height($(window).height());
</script>

复现2个条件
1、body或者view的-webkit-overflow-scrolling为touch
2、model的-webkit-overflow-scrolling为auto
当滚动model块到底时接着滑动会出现scrollview跟随滚动(不涉及click问题),
android上未出现这个问题

    原文作者:毛驴旅长
    原文地址: https://segmentfault.com/a/1190000013167065
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞