console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>两列伸缩栏</title>
<style>
* {
margin: 0;
padding: 0;
}
.outter {
width: 800px;
border: 2px solid black;
overflow: hidden;
margin: 0 auto;
}
.left {
width: 20%;
height: 500px;
float: left;
background-color: aliceblue;
}
.right {
width: 80%;
height: 500px;
float: left;
background-color: lightpink;
}
#bar {
width: 30px;
height: 50px;
padding-left: 5px;
background-color: grey;
border-bottom-right-radius: 15px;
}
</style>
<script src="js/jquery-1.11.1.min.js"></script>
<script>
$(function() {
$('#bar').click(function() {
var left = $('.left');
var right = $('.right');
var bar = $('#bar');
if (left.is(':hidden')) {
left.show();
right.css('width', '80%');
bar.html('隐藏');
} else {
left.hide();
right.css('width', '100%');
bar.html('显示');
}
});
});
</script>
</head>
<body>
<div class="outter">
<div class="left">
<ol>
<li>菜单1</li>
<li>菜单2</li>
<li>菜单3</li>
<li>菜单4</li>
<li>菜单5</li>
</ol>
</div>
<div class="right">
<div id="bar">隐藏</div>
</div>
</div>
</body>
</html>