当前位置:网站首页>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";
}
边栏推荐
- Mobile number regular expression input box loses focus verification
- Specific operations for uploading pictures in PHP
- How to open the DWG file of the computer
- Database overview
- 【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】
- Write shell script error summary
- Codeforces Round #802 (Div. 2) C D
- Penetration information collection steps (simplified version)
- parallel recovery slave next change & parallel recovery push change
- EL & JSTL (XIII)
猜你喜欢

In Net 6 using dotnet format formatting code

MySQL prevents Chinese garbled code and solves the problem of Chinese garbled code

February 20ctf record

Rce code execution & command execution (V)

【FLink】access closed classloader classloader. check-leaked-classloader

PHP calls map API

Which programming language is the most cumbersome to implement Hello world?

Leader: who can use redis expired monitoring to close orders and get out of here!

Visual studio 2022 interface beautification tutorial

buuctf(pwn)
随机推荐
Route parameters to jump to the page and transfer parameters -- > hidden parameter list
Chapter IX app project test (2) test tools
Mobile number regular expression input box loses focus verification
Matlab notes
JDBC (IV)
How to install the blue lake plug-in to support Photoshop CC 2017
基于SSH实现的学生成绩管理系统
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
Startup mode of SoC verification environment
Opensea PHP development kit
How do the defi protocols perform under this round of stress test?
Visual studio 2022 interface beautification tutorial
【Keil】ADuCM4050官方库的GPIO输出宏定义
TX Text Control 30.0 ActiveX
【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
成功解决:selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from
Google Earth Engine(GEE)——全球JRC/GSW1_1/YearlyHistory数据集的批量下载(中国区域)
魔法猪系统重装大师怎么使用
Compatible with Internet Explorer
XSS (cross site script attack) summary (II)