javascript+html5如何实现侧滑页面效果

本文实例为大家分享了html5实现侧滑页面效果展示的具体代码,供大家参考,具体内容如下 before:after:代码:

本文实例为大家分享了html5实现侧滑页面效果展示的具体代码,供大家参考,具体内容如下

before:

after:

代码:

<!DOCTYPE html>
<html>

 <head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
 <title></title>
 <script src="js/mui.min.js"></script>
 <link href="css/mui.min.css" rel="stylesheet" />
 <style type="text/css">
 .cover {
 background-color: #0062CC;
 height: 100%;
 width: 100%;
 display: none;
 opacity: 0;
 position: absolute;
 }
 
 .mui-off-canvas-left {
 background-color: #F0AD4E;
 }
 </style>
 </head>

 <body>
 <!-- 侧滑导航根容器 -->
 <div class="mui-off-canvas-wrap mui-draggable">
 <!-- 主页面容器 -->
 <div class="mui-inner-wrap">
 <!-- 菜单容器 -->
 <aside class="mui-off-canvas-left">
  <div class="mui-scroll-wrapper">
  <div class="mui-scroll">
  侧滑页面
  </div>
  </div>
 </aside>
 <!-- 主页面标题 -->
 <header class="mui-bar mui-bar-nav">
  <a class="mui-icon mui-action-menu mui-icon-bars mui-pull-left"></a>
  <h1 class="mui-title">标题</h1>
 </header>
 <!-- 主页面内容容器 -->
 <div class="mui-content mui-scroll-wrapper">
  <div class="cover"></div>
  <div class="mui-scroll">
  <!-- 主界面具体展示内容 -->
  主页面
  </div>
 </div>
 </div>
 </div>
 <script src="js/jquery-git.js"></script>
 <script type="text/javascript">
 $('.mui-pull-left').click(function() {
 mui('.mui-off-canvas-wrap').offCanvas('show');
 $('.cover').css('display', 'block');
 });

 $('.cover').click(function() {

 mui('.mui-off-canvas-wrap').offCanvas('close');
 $('.cover').css('display', 'none');
 });
 </script>
 </body>

</html>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持好代码网。

标签: js html5 侧滑页面