当前位置:网站首页>Using JS to realize the sidebar of life information network
Using JS to realize the sidebar of life information network
2022-06-25 05:02:00 【Dai Sensen】
effect : Click the colored egg icon in the head navigation bar under the small screen to draw the side navigation bar from the left , Click on ‘ fork ’ Icon closes the side navigation bar .
effect :
Code
1.html Code :
<!-- Sidebar Click -->
<div class="sidenav" id="sidenav">
<div class="colsesidenav glyphicon glyphicon-remove" id="colsesidenav"></div>
<ul class="clearfix">
<li> home page </li>
<li> Journalism </li>
<li> recommend </li>
<li> Hot list </li>
<li> parenting </li>
<li> beauty </li>
<li> plastic </li>
<li> Keeping in good health </li>
</ul>
</div>
<span class="hidden-lg hidden-md hidden-sm col-xs-2 sign" id="oversidenav">
<h6 class="glyphicon glyphicon-th-list"></h6>
</span>
ps: The icon here uses bootstrap The Font Icon
css Code :
#sidenav {
display: block;
position: fixed;
top: 0;
left: -99rem;
width: 70%;
height: 100%;
background-color: #fff;
z-index: 5;
transition: all 0.5s ease;
}
#sidenav #colsesidenav {
position: relative;
font-size: 0.533333rem;
top: 0.9rem;
left: 0.27rem;
}
#sidenav ul {
width: 100%;
top: 1rem;
left: 0.36rem;
position: relative;
}
#sidenav ul li {
padding: 0.24rem 0;
float: left;
width: 90%;
border-right: 1px solid #090;
}
#sidenav ul li:hover {
color: #090;
}
@media screen and (min-width: 768px) {
#sidenav {
display: none;
}
}
js Code :
var oversidenav = document.getElementById('oversidenav');
var sidenav = document.getElementById('sidenav');
var colsesidenav = document.getElementById('colsesidenav');
oversidenav.onclick = function() {
sidenav.style.top = "0";
sidenav.style.left = "0";
}
colsesidenav.onclick = function() {
sidenav.style.top = "0";
sidenav.style.left = "-99rem";
}
边栏推荐
- Startup mode of SoC verification environment
- parallel recovery slave next change & parallel recovery push change
- 2021-10-24
- How do the defi protocols perform under this round of stress test?
- The construction and usage of wampserver framework
- 【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
- cannot import name ‘escape’ from ‘jinja2’【成功解决】
- Database overview
- Deeply understand the characteristics of standard flow and off standard elements
- PHP uses JWT
猜你喜欢

Rce code execution & command execution (V)

Separation of storage and computing in Dahua cloud native database

TeeChart Pro ActiveX 2022.1

Records of ros2/dds/qos/ topics

Student achievement management system based on SSH

In Net 6 using dotnet format formatting code

《QDebug 2022年6月》
![[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]](/img/a1/f7a35a04e180e89d7f2fdbf89c1160.jpg)
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]

Kotlin compose perfect todo project surface rendering background and shadow

How to open the DWG file of the computer
随机推荐
Why does the SQL statement hit the index faster than it does not?
Rce code execution & command execution (V)
Database query optimization method
Summary of SQL injection (I)
【Keil】ADuCM4050官方库的GPIO输出宏定义
How micro engine uploads remote attachments
Swift rapid development
Detailed summary of position positioning
Teach you to write non maintainable PHP code step by step
固態硬盤開盤數據恢複的方法
In Net 6 using dotnet format formatting code
[keil] GPIO output macro definition of aducm4050 official library
How to install the blue lake plug-in to support Photoshop CC 2017
How to download and use Xiaobai one click reload on the official website
Wechat applet new version prompt update
CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
February 19 CTF exercise
olap分析引擎——Kylin4.0
Precise delay based on Cortex-M3 and M4 (systick delay of system timer can be used for STM32, aducm4050, etc.)