移动端h5商品横向列表ul li 左右滑动

#divscroller{
width:100%; 
max-width:2000px; //最大宽度
/*min-width:320px;*/
}
#divscroller .box123{
white-space: nowrap; //不允许换行
overflow-x: auto;   //x轴有超出部分显示滚动条
}
#divscroller .box123 li{
list-style: none;
        display: inline-block;  //行内块级元素
margin-bottom: 20px;
width: 250px;
}
.box123::-webkit-scrollbar{   //去除滚动条
width: 0;
height: 0;
display: none;
}

<div id="divscroller">

    <ul class="box123">
        <li>
    <img src="" width="250" height="180" style="margin: 20px 0 0 20px;"/><br />
    <span style="color: #777777;margin-left: 20px;font-size: 14px;">三高茶</span><br />
    <span style="color: red;margin-left: 20px;font-weight: bold;font-size: 18px;">¥456</span>
</li>
<li>
    <img src="" width="250" height="180" style="margin: 20px 0 0 20px;"/><br />
    <span style="color: #777777;margin-left: 20px;font-size: 14px;">三高茶</span><br />
    <span style="color: red;margin-left: 20px;font-weight: bold;font-size: 18px;">¥456</span>
</li>
<li>
    <img src="" width="250" height="180" style="margin: 20px 0 0 20px;"/><br />
    <span style="color: #777777;margin-left: 20px;font-size: 14px;">三高茶</span><br />
    <span style="color: red;margin-left: 20px;font-weight: bold;font-size: 18px;">¥456</span>
</li>
    </ul>
</div>
<script>
var u = navigator.userAgent;  
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端  
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端  
if(isAndroid&&isiOS){        /*注释5*/  
    $('.box123').on('touchstart',function(){  
    $(document).on('touchmove',function(e){  
        e.preventDefault();  
    });  
    $(document).on('touchend',function(){  
$(document).unbind();  
    });  
});  
    }  

</script>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值