-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathside_bar_sliding.html
More file actions
47 lines (42 loc) · 963 Bytes
/
side_bar_sliding.html
File metadata and controls
47 lines (42 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<button onclick="toggleSidebar()">☰ Open Sidebar</button>
<div class="sidebar" id="sidebar">
<a href="#">Dashboard</a>
<a href="#">Analytics</a>
<a href="#">Settings</a>
<button onclick="toggleSidebar()">Close</button>
</div>
<script>
function toggleSidebar() {
document.getElementById("sidebar").classList.toggle("active");
}
</script>
<style>
.sidebar {
position: fixed;
left: -250px;
top: 0;
width: 250px;
height: 100vh;
background: #222;
color: white;
padding: 20px;
transition: 0.3s;
}
.sidebar.active {
left: 0;
}
.sidebar a,
.sidebar button {
display: block;
padding: 10px;
color: white;
text-decoration: none;
border: none;
background: none;
text-align: left;
}
.sidebar a:hover,
.sidebar button:hover {
background: #444;
}
</style>