关于ios滑动卡顿问题

1,506 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>关于ios滑动卡顿问题</title>
    <style>
        .wrap {
            width: 100%;
            height: 100px;
            overflow: auto;
            /* 解决ios卡顿问题 */
            -webkit-overflow-scrolling: touch;
            border: 1px solid red;
        }

        /* 隐藏滚动条 */
        .wrap::-webkit-scrollbar {
            display: none
        }

        .wrap .box {
            overflow: auto;
            width: 2500px;
        }

        .wrap .box div {
            width: 200px;
            height: 100px;
            margin: 0 20px;
            background: pink;
            float: left;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <div class="box">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
            <div>7</div>
            <div>8</div>
            <div>9</div>
            <div>10</div>
        </div>
    </div>
</body>
</html>