With regard to the horizontal and vertical movement of the mobile browser, you can scroll, but it does not show how the scroll bar is implemented, as shown in the following figure

< H2 > question < / H2 >

how to achieve this effect, do not use plug-ins, do not use webkit pseudo-classes to hide scroll bars

< H2 > actual effect < / H2 >

1. The mobile web page JD.com, vertically, can scroll up and down
2. Baidu mobile web page, horizontal, you can scroll
clipboard.png

clipboard.png

Mar.31,2021

check the console. It's nothing more than hiding the scroll bar

.

clipboard.png




overflowoverflow

<div class="top"></div>
<div style="display: inline-block;width: 20%;">
    <div>
        <ul>
            <li class="test-li">1</li>
            <li class="test-li">2</li>
            <li class="test-li">3</li>
            <li class="test-li">4</li>
            <li class="test-li">5</li>
            <li class="test-li">6</li>
            <li class="test-li">7</li>
            <li class="test-li">8</li>
            <li class="test-li">9</li>
            <li class="test-li">10</li>
            <li class="test-li">11</li>
            <li class="test-li">12</li>
            <li class="test-li">13</li>
            <li class="test-li">14</li>
            <li class="test-li">15</li>
            <li class="test-li">16</li>
            <li class="test-li">17</li>
            <li class="test-li">18</li>
        </ul>
    </div>
</div>
<div style="display: inline-block;width: 78%"></div>
<div class="bottom"></div>

<style>
    * {
        margin: 0;
        padding: 0;
        }

    ul {
        list-style: none;
        height: 70vh;
        overflow-y: auto;
    }

    .top,
    .bottom {
        width: 100%;
        height: 100px;
        background-color: aqua;
        text-align: center;
        font-size: 2rem;
        line-height: 100px;
    }

    .test-li {
        background-color: grey;
        text-align: center;
        padding: 10px;
        border-bottom: 1px solid -sharpeee;
    }
</style>


of course, it's OK to listen to touchstart touchmove touchend and modify style transform: translate () dynamically, but it's a bit of a hassle.

Menu