您的位置:首页 > 移动开发

Slideout.js触摸滑出式 Web App 导航菜单调用方法

2015-07-01 14:31 429 查看
https://github.com/mango/slideout/releases/

1. First of all, you'll need to have a menu ("#menu") and a main content ("#panel") into your body.
<nav id="menu">
<header>
<h2>Menu</h2>
</header>
</nav>

<main id="panel">
<header>
<h2>Panel</h2>
</header>
</main>


2. Add the Slideout.js styles (index.css) in your web application.
body {
width: 100%;
height: 100%;
}

.slideout-menu {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 0;
width: 256px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
display: none;
}

.slideout-panel {
position: relative;
z-index: 1;
}

.slideout-open,
.slideout-open body,
.slideout-open .slideout-panel {
overflow: hidden;
}

.slideout-open .slideout-menu {
display: block;
}


3. Then you just include Slideout.js and create a new instace with some options:
<script src="dist/slideout.min.js"></script>
<script>
var slideout = new Slideout({
'panel': document.getElementById('panel'),
'menu': document.getElementById('menu'),
'padding': 256,
'tolerance': 70
});
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: