File tree Expand file tree Collapse file tree 3 files changed +120
-0
lines changed
Expand file tree Collapse file tree 3 files changed +120
-0
lines changed Original file line number Diff line number Diff line change @@ -198,4 +198,78 @@ nav a:hover {
198198# container_content ::-webkit-scrollbar-track {
199199 -webkit-box-shadow : inset 0 0 6px rgba (0 , 0 , 0 , 0.3 );
200200 background-color : # f5f5f5 ;
201+ }
202+
203+ /* Mobile Hamburger Menu Button */
204+ # mobile-menu-toggle {
205+ display : none;
206+ position : fixed;
207+ top : 10px ;
208+ left : 10px ;
209+ z-index : 1001 ;
210+ background-color : # 9c53e8 ;
211+ color : white;
212+ border : none;
213+ padding : 10px 12px ;
214+ border-radius : 4px ;
215+ cursor : pointer;
216+ font-size : 20px ;
217+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.3 );
218+ }
219+
220+ # mobile-menu-toggle : hover {
221+ background-color : # f7ae61 ;
222+ }
223+
224+ # mobile-menu-toggle : active {
225+ transform : scale (0.95 );
226+ }
227+
228+ /* Mobile Overlay */
229+ # mobile-overlay {
230+ display : none;
231+ position : fixed;
232+ top : 0 ;
233+ left : 0 ;
234+ right : 0 ;
235+ bottom : 0 ;
236+ background-color : rgba (0 , 0 , 0 , 0.5 );
237+ z-index : 999 ;
238+ }
239+
240+ /* Mobile Responsive Styles */
241+ @media screen and (max-width : 768px ) {
242+ # mobile-menu-toggle {
243+ display : block;
244+ }
245+
246+ # container_navigation {
247+ transform : translateX (-100% );
248+ transition : transform 0.3s ease-in-out;
249+ z-index : 1000 ;
250+ }
251+
252+ # container_navigation .mobile-open {
253+ transform : translateX (0 );
254+ }
255+
256+ # container_content {
257+ left : 0 ;
258+ width : 100% ;
259+ padding-left : 10px ;
260+ padding-right : 10px ;
261+ }
262+
263+ # logo {
264+ width : 100% ;
265+ font-size : 28px ;
266+ }
267+
268+ # wiki-search {
269+ width : calc (100% - 20px );
270+ }
271+
272+ # mobile-overlay .mobile-open {
273+ display : block;
274+ }
201275}
Original file line number Diff line number Diff line change 1+ // Mobile menu toggle functionality
2+ ( function ( ) {
3+ var menuToggle = document . getElementById ( 'mobile-menu-toggle' ) ;
4+ var navigation = document . getElementById ( 'container_navigation' ) ;
5+ var overlay = document . getElementById ( 'mobile-overlay' ) ;
6+
7+ if ( menuToggle && navigation && overlay ) {
8+ function toggleMenu ( ) {
9+ navigation . classList . toggle ( 'mobile-open' ) ;
10+ overlay . classList . toggle ( 'mobile-open' ) ;
11+ }
12+
13+ function closeMenu ( ) {
14+ navigation . classList . remove ( 'mobile-open' ) ;
15+ overlay . classList . remove ( 'mobile-open' ) ;
16+ }
17+
18+ menuToggle . addEventListener ( 'click' , function ( e ) {
19+ e . stopPropagation ( ) ;
20+ toggleMenu ( ) ;
21+ } ) ;
22+
23+ overlay . addEventListener ( 'click' , function ( ) {
24+ closeMenu ( ) ;
25+ } ) ;
26+
27+ // Close menu when clicking on a navigation link
28+ var navLinks = navigation . querySelectorAll ( 'a' ) ;
29+ navLinks . forEach ( function ( link ) {
30+ link . addEventListener ( 'click' , function ( ) {
31+ closeMenu ( ) ;
32+ } ) ;
33+ } ) ;
34+
35+ // Close menu on escape key
36+ document . addEventListener ( 'keydown' , function ( e ) {
37+ if ( e . key === 'Escape' && navigation . classList . contains ( 'mobile-open' ) ) {
38+ closeMenu ( ) ;
39+ }
40+ } ) ;
41+ }
42+ } ) ( ) ;
43+
Original file line number Diff line number Diff line change 4242 {extra_css}
4343</ head >
4444< body >
45+ < button id ="mobile-menu-toggle " aria-label ="Toggle menu "> ☰</ button >
46+ < div id ="mobile-overlay "> </ div >
4547 < div id ="wrapper ">
4648 < div id ="container_navigation ">
4749 < div id ="logo ">
5860 < script src ="{assets_path}navigation.js " defer > </ script >
5961 < script src ="{assets_path}dark-mode.js " defer > </ script >
6062 < script src ="{assets_path}search.js " defer > </ script >
63+ < script src ="{assets_path}mobile-menu.js " defer > </ script >
6164</ body >
6265</ html >
6366
You can’t perform that action at this time.
0 commit comments