前言
由于 Mui 官网写的文档不详细,所以在此记录一下 Div 模式的侧滑菜单
完整代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Hello MUI</title> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" href="css/mui.min.css" /> </head>
<body> <div class="mui-off-canvas-wrap mui-draggable"> <aside id="offCanvasSide" class="mui-off-canvas-left"> <div id="boxx" class="mui-scroll-wrapper"> <div class="mui-scroll"> <div class="tx"> <img /> </div> <div class="name">张三</div> <ul id="menuList" class="mui-table-view mui-table-view-chevron"> <li class="mui-table-view-cell mui-media"> <a href="javascript:;" id="zhuYe"> 首页 </a> </li> <li class="mui-table-view-cell mui-media"> <a href="javascript:;" id="xinDe"> 心得 </a> </li> <li class="mui-table-view-cell mui-media"> <a href="javascript:;" id="gyhd"> 公益活动 </a> </li> <li class="mui-table-view-cell mui-media"> <a href="javascript:;" id="sjfx"> 数据分析 </a> </li> <li class="mui-table-view-cell mui-media"> <a href="javascript:;" id="sheZhi"> 设置 </a> </li> </ul> </div> </div> </aside> <div class="mui-inner-wrap"> <header class="mui-bar mui-bar-nav"> <a href="#offCanvasSide" class="mui-icon mui-action-menu mui-icon-bars mui-pull-left" ></a> <h1 class="mui-title">首页</h1> </header> <div id="box" class="mui-content mui-scroll-wrapper"> <div class="mui-scroll"> <div class="mui-content"></div> </div> </div> <div class="mui-off-canvas-backdrop"></div> </div> </div> <script src="js/mui.min.js"></script> <script> mui.init();
mui("#box").scroll(); mui("#boxx").scroll(); </script> </body> </html>
|
补充
显示侧滑按钮的事件
1
| offCanvasWrapper.offCanvas("show");
|
显示侧滑按钮的事件
1
| offCanvasWrapper.offCanvas("hide");
|