给你个例子
<title>div css3 侧边菜单导航栏-www.codesc.net</title><style type="text/css">
*{margin:0padding:0list-style-type:none}
a,img{border:0}
body{font:12px/180% Arial, Helvetica, sans-serif, "微软雅黑"}
.demo{margin:60px autowidth:720px}
.navbox{float:left}
ul.nav{width:200pxpadding:60px 0 60px 0background:url() no-repeat}
ul.nav li{margin:5px 0 0 0}
ul.nav li a{
background:#cbcbcb url() no-repeatcolor:#174867padding:7px 15px 7px 15pxwidth:100pxdisplay:blocktext-decoration:none
-webkit-transition:all 0.3s ease-out
-moz-transition:all 0.3s ease-out
-o-transition:all 0.3s ease-out
-webkit-box-shadow:2px 2px 4px #888
-moz-box-shadow:2px 2px 4px #888
-o-box-shadow:2px 2px 4px #888
}
ul.nav li a:hover{background:#ebebeb url() no-repeatcolor:#67a5cdpadding:7px 15px 7px 30px}
</style>
<div class="demo">
<div class="navbox">
<ul class="nav">
<li><a href="#">XHTML</a></li>
<li><a href="#">C++</a></li>
<li><a href="#">Mootools</a></li>
<li><a href="#">HTML5</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">Ajax</a></li>
<li><a href="#">PHP</a></li>
<li><a href="#">Perl</a></li>
</ul>
</div>
<div class="navbox">
<ul class="nav">
<li><a href="#">XHTML</a></li>
<li><a href="#">HTML5</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">Ajax</a></li>
<li><a href="#">PHP</a></li>
</ul>
</div>
<div class="navbox">
<ul class="nav">
<li><a href="#">XHTML</a></li>
<li><a href="#">HTML5</a></li>
<li><a href="#">CSS</a></li>
</ul>
</div>
</div>
大致思路
左侧:菜单,给每个菜单设置id和onclick点击事件,onclick事件触发的函数假设写为display()
右侧:写个固定样式的div,id假设设置为board。
如果你的菜单内容在服务器
display()的实现如下
function display(){$.ajax({
type: "POST",
url: 菜单所请求的内容地址,
data: this.id等等相关的请求标志,
success: funtion(data){$('board').html(data)},//返回数据填充
dataType: dataType})
}
如果菜单内容写死在页面内
那么右侧:写和菜单数一样多的div,把所有的display属性设置为none
同时display()的实现如下
function display(){$('#'+$(this).attr('rel')).style.display='block'
}
以上,伪代码,仅供参考
<!doctype html><html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery弹出侧边栏滑动菜单 - 何问起</title><base target="_blank" />
<link rel="stylesheet" href="hto/html5/19/css/reset.css">
<link rel="stylesheet" href="htcom/texiao/html5/19/css/style.css">
<script language="javascript" src="om/ziyuan/jquery/jquery-2.2.0.min.js"></script>
<script language="javascript" src="js/main.js"></script>
<!--[if IE]>
<script src="hte.com/texiao/html5/4/html5shiv.min.js"></script>>
<![endif]-->
</head>
<body>
<main>
<header>
<h1>jQuery弹出侧边栏滑动菜单 <span>A Full-Screen Pushing Navigation</span></h1>
<p>A full page menu, that replaces the current content by pushing it off the screen.</p>
<p><a href="htt.com/">首页</a><a href="hm/texiao/">特效</a><a href="httm/h/bjaf/manpingmenu.htm">原文</a>
</p>
</header>
</main>
<a href="#cd-nav">
Menu
<span></span>
<svg x="0px" y="0px" width="54px" height="54px" viewBox="0 0 54 54">
<circle fill="transparent" stroke="#656e79" stroke-width="1" cx="27" cy="27" r="25" stroke-dasharray="157 157" stroke-dashoffset="157"></circle>
</svg>
</a>
<div id="cd-nav">
<div>
<div>
<h2>导航菜单</h2>
<nav>
<ul>
</ul>
</nav>
</div>
<div>
<address>
<ul>
<li><a href="mailto:hovertree@hovertree.com">hovertree@hovertree.com</a></li>
<li>021-00000000</li>
<li>
<span>何问起</span>
<span>hovertree.com</span>
<span>keleyi菜单</span>
</li>
</ul>
</address>
</div>
</div>
</div>
</body>
</html>