码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2014-07-18 00:24:22      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   width   

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

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

标签:style   blog   http   color   os   width   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!