Skip to content

Commit 2bb53cd

Browse files
committed
Merge branch 'sidebar_reponsive_mobile' of github.com:riteshsp2000/p5.js-website
2 parents affa902 + 53d8c12 commit 2bb53cd

File tree

2 files changed

+92
-2
lines changed

2 files changed

+92
-2
lines changed

src/assets/css/main.css

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,94 @@
7272
z-index: -2;
7373
}
7474

75+
/* <======== Styling for responsive menu bar ========> */
76+
77+
@media screen and (max-width: 719px) {
78+
.sidebar-menu {
79+
clear: both;
80+
max-height: 0;
81+
transition: max-height .4s ease-out;
82+
overflow: hidden;
83+
}
84+
85+
.sidebar-menu-nav-element {
86+
width: 91vw;
87+
}
88+
89+
.sidebar-menu a {
90+
display: block;
91+
text-align: center;
92+
}
93+
94+
.sidebar-menu-icon {
95+
top: 2rem;
96+
cursor: pointer;
97+
float: right;
98+
padding: 28px 20px;
99+
position: relative;
100+
user-select: none;
101+
margin-bottom: 5rem;
102+
}
103+
104+
.sidebar-menu-icon .sidebar-nav-icon {
105+
background: #ED225D;
106+
display: block;
107+
height: 2px;
108+
position: relative;
109+
transition: background .4s ease-out;
110+
width: 18px;
111+
}
112+
113+
.sidebar-menu-icon .sidebar-nav-icon:before,
114+
.sidebar-menu-icon .sidebar-nav-icon:after {
115+
background: #ED225D;
116+
content: '';
117+
display: block;
118+
height: 100%;
119+
position: absolute;
120+
transition: all .4s ease-out;
121+
width: 100%;
122+
}
123+
124+
.sidebar-menu-icon .sidebar-nav-icon:before {
125+
top: 5px;
126+
}
127+
128+
.sidebar-menu-icon .sidebar-nav-icon:after {
129+
top: -5px;
130+
}
131+
132+
.sidebar-menu-btn {
133+
display: none;
134+
}
135+
136+
.sidebar-menu-btn:checked ~ .sidebar-menu {
137+
max-height: 475px;
138+
}
139+
140+
.sidebar-menu-btn:checked ~ .sidebar-menu-icon .sidebar-nav-icon {
141+
background: transparent;
142+
}
143+
144+
.sidebar-menu-btn:checked ~ .sidebar-menu-icon .sidebar-nav-icon:before {
145+
transform: rotate(-45deg);
146+
top:0;
147+
}
148+
149+
.sidebar-menu-btn:checked ~ .sidebar-menu-icon .sidebar-nav-icon:after {
150+
transform: rotate(45deg);
151+
top:0;
152+
}
153+
154+
}
155+
156+
.sidebar-menu-btn {
157+
display: none;
158+
}
159+
160+
161+
/* <=================================================> */
162+
75163
#home-sketch-frame {
76164
position: fixed;
77165
width: 100%;

src/templates/partials/sidebar.hbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ slug: sidebar
33
---
44
<!-- site navigation -->
55
<div class="column-span">
6-
<nav>
6+
<nav class="sidebar-menu-nav-element">
77
<h2 id="menu-title" class="sr-only">{{#i18n "Sidebar-Title"}}{{/i18n}}</h2>
8-
<ul id="menu" aria-labelledby="menu-title">
8+
<input class="sidebar-menu-btn" type="checkbox" id="sidebar-menu-btn" />
9+
<label class="sidebar-menu-icon" for="sidebar-menu-btn"><span class="sidebar-nav-icon"></span></label>
10+
<ul id="menu" class="sidebar-menu" aria-labelledby="menu-title">
911
<li><a href="{{root}}/">{{#i18n "Home"}}{{/i18n}}</a></li>
1012
<li><a href="https://editor.p5js.org">{{#i18n "Editor"}}{{/i18n}}</a></li>
1113
<li><a href="{{root}}/download/">{{#i18n "Download"}}{{/i18n}}</a></li>

0 commit comments

Comments
 (0)