File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,3 +352,58 @@ li {
352352 zoom : 1.4 ;
353353 }
354354}
355+
356+ # burger-menu {
357+ display : none;
358+ background : none;
359+ border : none;
360+ color : white;
361+ font-size : 1.5rem ;
362+ cursor : pointer;
363+
364+ margin : 0 ;
365+ padding : 0 ;
366+ position : fixed;
367+ top : 6px ;
368+ left : 10px ;
369+ z-index : 1000 ; /* Ensure it stays above other elements */
370+ }
371+
372+ /* Show the burger menu only on small screens */
373+ @media screen and (max-width : 800px ) {
374+ # burger-menu {
375+ display : inline-block;
376+ }
377+
378+ # menu {
379+ margin-left : 40px ;
380+ width : 85% ;
381+ }
382+ }
383+
384+ @media screen and (max-width : 800px ) {
385+ # sidebar , # logo {
386+ display : none; /* Hide sidebar and logo by default */
387+ }
388+
389+ body {
390+ grid-template-columns : 1fr ; /* Single column layout by default */
391+ grid-template-areas :
392+ "menu"
393+ "content"
394+ "footer" ; /* Simple grid layout */
395+ }
396+
397+ /* When the sidebar and logo are shown (burger menu active) */
398+ body .show-sidebar {
399+ grid-template-columns : 250px auto; /* Two columns: sidebar + content */
400+ grid-template-areas :
401+ "logo menu"
402+ "side content"
403+ "footer footer" ; /* Restore the two-column layout */
404+ }
405+
406+ # sidebar .active , # logo .active {
407+ display : block; /* Show sidebar and logo when 'active' */
408+ }
409+ }
Original file line number Diff line number Diff line change 2626 <body>
2727 <a id="logo" href="/"></a>
2828 <nav id="menu">
29+ <!-- burger menu -->
30+ <button id="burger-menu" aria-label="Toggle Menu">☰</button> <!-- Burger menu icon -->
31+
2932 <a href="/">Home</a>
3033 •
3134 <a href="$site.page('tutorials/getting_started').link()">Quickstart</a>
4144 <a href="https://github.com/zml/zml" target="_blank">Code</a>
4245 •
4346 <a href="https://discord.gg/6y72SN2E7H" target="_blank">Discord</a>
47+
48+
4449 </nav>
4550 <!-- <hr style="width:min(600px, 100vw); border-color:#0798b3; color: white; border-top:1px;"> -->
4651 <aside id="sidebar" class="sidebar">
7580 <!-- OPTION 2: ZML only -->
7681 <!-- © in 2024 by <a href="https://zml.ai" target="_blank">ZML.ai</a> -->
7782 </footer>
83+
84+ <!-- burger menu script -->
85+ <script>
86+ document.getElementById('burger-menu').addEventListener('click', function() {
87+ const sidebar = document.getElementById('sidebar');
88+ const logo = document.getElementById('logo');
89+ const body = document.body;
90+
91+ // Toggle the 'active' class on sidebar and logo to show/hide them
92+ sidebar.classList.toggle('active');
93+ logo.classList.toggle('active');
94+
95+ // Toggle the 'show-sidebar' class on the body to adjust the grid layout
96+ body.classList.toggle('show-sidebar');
97+ });
98+ </script>
7899 </body>
79100</html>
You can’t perform that action at this time.
0 commit comments