3 ms·
How do you get mobile navbars to work without JS? When I've built websites before, they're typically the only place I'm compelled to use JS in.
by vulcan01 6y ago
How do you get mobile navbars to work without JS? When I've built websites before, they're typically the only place I'm compelled to use JS in.
- tannhaeuser 6y agoWhile you can implement sidenavs using just CSS, you can't implement reveal menus which have become the most common nav for simple sites such as portfolios. Ie where you start with your fat logo centered and have it shrink into a fixed/sticky top menu/logo as you need to interrogate the scroll position for that.
- darepublic 6y agoCSS my friend.. also u can technically post back to the server for even switching between hamburger open and closed, if u want to take it that far.
- robgibbons 6y agoIf you mean something like a sidebar that pops out, that's definitely possible via some clever CSS. Make the menu button a hidden checkbox and add a CSS transition to move your sidebar based on its checked state.
- vulcan01 6y agoI hadn't thought of this; thank you!
- wishinghand 6y agoDo you mean menus that hide off-screen and then slide over to fill the screen once a menu icon is touched? If so, I dducked "css only slide out menu" and this was the second result: https://1stwebdesigner.com/pure-css-navigation-menus/ https://1stwebdesigner.com/pure-css-navigation-menus/
- cmroanirgo 6y agoUse a hidden checkbox. No js necessary. Eg. https://stackoverflow.com/questions/31506684/expand-collapse-mobile-navbar-without-javascript https://stackoverflow.com/questions/31506684/expand-collapse...