首页 > 移动平台 > 详细

移动端导航显示在左侧,显示时全屏右推实现

时间:2014-07-17 18:24:30      阅读:417      评论:0      收藏:0      [点我收藏+]

bubuko.com,布布扣

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<style>
*{margin:0;padding:0;}
html, body {
    height: 100%;
}
body {
    overflow-x: hidden;
    width: 320px;
    background: #ccc;
}
#nav {
    position: absolute;
    left: -100px;
    top: 0;
    width: 100px;
    height: 100%;
    background: #f90;
}
#content {
    margin: 0 auto;
    width: 320px;
    height: 100%;
    background: #666;
}
.showNav {
    transform: translateX(100px);
    -webkit-transform: translateX(100px);
    transition: transform 1s;
    -webkit-transition: -webkit-transform 1s;
}
</style>
</head>
<body>
<div id="nav"></div>
<div id="content">
    <input type="button" value="点我试试" id="btn">
</div>
<script>
var oBtn = document.getElementById("btn");

oBtn.onclick = function() {
    document.body.className = "showNav";
}
</script>
</body>
</html>

移动端导航显示在左侧,显示时全屏右推实现,布布扣,bubuko.com

移动端导航显示在左侧,显示时全屏右推实现

原文:http://www.cnblogs.com/qiangspecial/p/3851391.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!