移动端横向滚动

2019-10-24  本文已影响0人  王小妞闯天涯

html:

<div class="buy_type">

        <div class="buy_type_box " :class="{buy_type_select:selectIndex === index}" @click="selectBag(index)" v-for="(item,index) in bagData">

        </div>

      </div>

css:

.buy_type {

        margin-top: 40px;

        justify-content: center;

        white-space: nowrap;

        display: -webkit-box;

        overflow-x: scroll;

        overflow-y: hidden;

        -webkit-overflow-scrolling:touch;

        &_box {

          display: inline-block;

          background: $color_white;

          border: solid 0.2vh #E4E4E4;

          border-radius: 10px;

          width: 200px;

          position: relative;

          margin-left: 20px;

}

主要利用:

-webkit-overflow-scrolling:touch;

display: -webkit-box;

        overflow-x: scroll;

        overflow-y: hidden;

实现横向滚动

上一篇下一篇

猜你喜欢

热点阅读