斗鱼的sidebar的实现简陋的demo

时间:2023-03-09 01:48:22
斗鱼的sidebar的实现简陋的demo

斗鱼的sidebar的实现简陋的demo

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" />
<title></title>
<style>
.sidebar{
position:fixed;
top:0;
left:0;
background:#f00;
}
.content{
width:200px;
background:#666;
height:200px;
}
.left-smcontent{
width:57px;
display:none;
background:#ccc;
height:200px;
}
.small .content{ display:none;}
.small .left-smcontent{ display:block;}
.small .close{left:57px;}
.close{
position:fixed;
top:50%;
left:200px;
display:inline-block;
width:30px;
height:30px;
background:red;
}
.main{margin-left:250px;}
</style>
</head>
<body>
<div id="sidebar" class="sidebar">
<div class="content"></div>
<div class="left-smcontent"></div>
<a href="javascript:;" id="close" class="close"></a>
</div>
<div class="main" id="main">2222222</div>
</body>
</html>

运行

//因为时间比较紧张,没有对源码进行详细的介绍,在周末的优化的时候都会一一的补上,并且对代码进行优化

.sidebar{
position:fixed;
top:0;
left:0;
background:#f00;
}
.content{
width:200px;
background:#666;
height:200px;
}
.left-smcontent{
width:57px;
display:none;
background:#ccc;
height:200px;
}
.small .content{ display:none;}
.small .left-smcontent{ display:block;}
.small .close{left:57px;}
.close{
position:fixed;
top:50%;
left:200px;
display:inline-block;
width:30px;
height:30px;
background:red;
}
.main{margin-left:250px;}
2222222