mui横向滑动菜单

<style>
.mui-bar a {
color: #E02D26;
}
#topItem {
background: white;
border-bottom: 1px solid #EEEEEE;
}
.mui-slider .mui-segmented-control.mui-scroll-wrapper {
height: 40px;
}
.mui-slider .mui-segmented-control .mui-control-item {
line-height: 37px;
}
.mui-segmented-control.mui-scroll-wrapper .mui-control-item {
padding: 0 12px
}
.mui-slider .mui-segmented-control.mui-segmented-control-inverted .mui-control-item {
border-bottom: 2px solid white;
color: black;
}
.mui-slider .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
border-bottom: 2px solid #E02D26;
color: #E02D26;
font-weight: bold;
}
.mui-slider-group .mui-slider-item {
height: 0px;
}
</style>

 

<div id="slider" class="mui-slider">
<div id="topItem" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
<div class="mui-scroll" id="top-scroll">
<a class='mui-control-item mui-active' href="#item1mobile">男装</a>
<a class='mui-control-item' href="#item2mobile">女装</a>
<a class='mui-control-item' href="#item3mobile">手机</a>
<a class='mui-control-item' href="#item4mobile">护肤</a>
<a class='mui-control-item' href="#item5mobile">护发</a>
<a class='mui-control-item' href="#item6mobile">电脑</a>
<a class='mui-control-item' href="#item7mobile">家具</a>
<a class='mui-control-item' href="#item8mobile">护理</a>
<a class='mui-control-item' href="#item9mobile">厨房</a>
<a class='mui-control-item' href="#item10mobile">卫浴</a>
<a class='mui-control-item' href="#item11mobile">幼儿</a>
<a class='mui-control-item' href="#item12mobile">童装</a>
<a class='mui-control-item' href="#item13mobile">零食</a>
<a class='mui-control-item' href="#item14mobile">运动</a>
<a class='mui-control-item' href="#item15mobile">手表</a>
<a class='mui-control-item' href="#item16mobile">内衣</a>
<a class='mui-control-item' href="#item17mobile">箱包</a>
<a class='mui-control-item' href="#item18mobile">书籍</a>
<a class='mui-control-item' href="#item19mobile">茶酒</a>
<a class='mui-control-item' href="#item20mobile">配件</a>
</div>
</div>
<!--勿删除以下代码,作用是保证顶部菜单动画-->
<div class="mui-slider-group" style="height: 0px;">
<div id="item1mobile" class="mui-slider-item mui-control-content mui-active"></div>
<div id="item2mobile" class="mui-slider-item mui-control-content"></div>
<div id="item3mobile" class="mui-slider-item mui-control-content"></div>
<div id="item4mobile" class="mui-slider-item mui-control-content"></div>
<div id="item5mobile" class="mui-slider-item mui-control-content"></div>
<div id="item6mobile" class="mui-slider-item mui-control-content"></div>
<div id="item7mobile" class="mui-slider-item mui-control-content"></div>
<div id="item8mobile" class="mui-slider-item mui-control-content"></div>
<div id="item9mobile" class="mui-slider-item mui-control-content"></div>
<div id="item10mobile" class="mui-slider-item mui-control-content"></div>
<div id="item11mobile" class="mui-slider-item mui-control-content"></div>
<div id="item12mobile" class="mui-slider-item mui-control-content"></div>
<div id="item13mobile" class="mui-slider-item mui-control-content"></div>
<div id="item14mobile" class="mui-slider-item mui-control-content"></div>
<div id="item15mobile" class="mui-slider-item mui-control-content"></div>
<div id="item16mobile" class="mui-slider-item mui-control-content"></div>
<div id="item17mobile" class="mui-slider-item mui-control-content"></div>
<div id="item18mobile" class="mui-slider-item mui-control-content"></div>
<div id="item19mobile" class="mui-slider-item mui-control-content"></div>
<div id="item20mobile" class="mui-slider-item mui-control-content"></div>
</div>
</div>

以下是一个简单的mui下拉菜单代码示例: HTML: ``` <header class="mui-bar mui-bar-nav"> <a class="mui-action-menu mui-icon mui-icon-bars mui-pull-left"></a> <h1 class="mui-title">下拉菜单</h1> </header> <div class="mui-content"> <div class="mui-content-padded"> <p>点击左上角菜单按钮展示下拉菜单</p> </div> <ul class="mui-table-view mui-table-view-chevron"> <li class="mui-table-view-cell"> <a href="#">菜单项1</a> </li> <li class="mui-table-view-cell"> <a href="#">菜单项2</a> </li> <li class="mui-table-view-cell"> <a href="#">菜单项3</a> </li> </ul> </div> ``` CSS: ``` .mui-bar-nav a.mui-action-menu { font-size: 24px; } ``` JavaScript: ``` mui.init({ swipeBack: false }); var menuWrapper = document.getElementById('menu-wrapper'); var menu = document.getElementById('menu'); var menuWrapperClassList = menuWrapper.classList; var backdrop = document.getElementById('menu-backdrop'); document.getElementById('show-menu').addEventListener('tap', function() { menuWrapperClassList.add('mui-active'); backdrop.addEventListener('tap', closeMenu); menu.addEventListener('webkitTransitionEnd', menuTransitionEnd); backdrop.show(); }); var closeMenu = function() { menuWrapperClassList.remove('mui-active'); backdrop.removeEventListener('tap', closeMenu); menu.removeEventListener('webkitTransitionEnd', menuTransitionEnd); backdrop.hide(); } var menuTransitionEnd = function(e) { if (e.target === menu) { backdrop.removeEventListener('tap', closeMenu); backdrop.addEventListener('tap', closeMenu); } } ``` 注:以上代码需要引入mui.css和mui.js文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值