File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11document . querySelectorAll ( "nav img, nav a" ) . forEach ( e => {
22 e . addEventListener ( "click" , ( ) => {
3- const navElement = document . querySelector ( "nav" ) ;
4- navElement . classList . toggle ( "visible" ) ;
5- setTimeout ( ( ) => {
6- navElement . scrollTo ( { top : 0 , behavior : "smooth" } ) ; // Reset scroll position
7- } , 0 ) ;
3+ if ( window . innerWidth < 800 ) {
4+ const navElement = document . querySelector ( "nav" ) ;
5+ navElement . classList . toggle ( "visible" ) ;
6+ setTimeout ( ( ) => {
7+ navElement . scrollTo ( { top : 0 , behavior : "smooth" } ) ; // Reset scroll position
8+ } , 0 ) ;
9+ }
810 } )
911} ) ;
1012
Original file line number Diff line number Diff line change @@ -48,4 +48,5 @@ const updateScroll = () => {
4848
4949updateScroll ( ) ;
5050main . addEventListener ( "scroll" , updateScroll ) ;
51+ nav . addEventListener ( "scroll" , updateScroll ) ;
5152window . addEventListener ( "resize" , updateScroll ) ;
Original file line number Diff line number Diff line change 2424 position : absolute;
2525 width : 100vw ;
2626 height : calc (15px + 48px ); /* Set the height relative to the padding to only show the menu icon */
27+ max-height : max-content;
2728 box-sizing : border-box;
2829
2930 padding : 15px 30px ;
@@ -42,18 +43,20 @@ nav {
4243 overscroll-behavior : none;
4344}
4445
45- /* FIXME: Maybe push these links to the bottom of the screen if we have space on desktop? */
46+ /* Push the nav links block to the bottom of the nav when
47+ there is extra vertical space. */
4648# nav-links {
4749 position : relative;
4850 width : 100% ;
49- margin-top : 0.3em ;
5051 text-align : center;
5152 font-size : 2em ;
53+ margin-top : auto;
54+ text-align : center;
5255}
5356
5457# nav-links a {
5558 color : inherit;
56- padding : 0.2em 0.5 em ;
59+ padding : 0.2em 0.2 em ;
5760 margin : auto;
5861}
5962
@@ -70,7 +73,6 @@ nav h2 {
7073
7174/* This class gets applied when the menu is opened on mobile */
7275nav .visible {
73- height : 100vh ;
7476 overflow : scroll;
7577}
7678
@@ -209,11 +211,17 @@ table.commands tr:nth-child(1) {
209211
210212/* Large screens only */
211213@media (min-width : 800px ) {
212- /* ""Undo"" all the mobile styling */
214+ body {
215+ grid-template-columns : max-content 1fr ;
216+ }
217+
213218 nav {
219+ display : flex;
220+ flex-direction : column;
214221 position : unset;
215- width : unset;
216- height : unset;
222+ width : auto;
223+ height : 100vh ;
224+ max-height : unset;
217225 overflow : auto;
218226 }
219227
Original file line number Diff line number Diff line change 1212
1313 < body >
1414 < nav >
15- < img src ="/menu-icon.svg " alt ="Menu " width ="48px " height ="48px ">
16- < h2 > Portal 2 Rules</ h2 >
15+ < div >
16+ < img src ="/menu-icon.svg " alt ="Menu " width ="48px " height ="48px ">
17+ < h2 > Portal 2 Rules</ h2 >
18+ </ div >
1719 {{NAV_MENU}}
1820 </ nav >
1921 < main >
You can’t perform that action at this time.
0 commit comments