March 9, 201511 yr Hi there, I'm just starting out and am a little bit hazy on the best way to design a nav menu. I'm hearing talk of pure CSS, which sounds simple but these menus look a little basic from what I've seen. So for a design with any credibility should I be using Javascript and JQuery? Or a mixture of all? I want my menu to look stylish and be compatible with mobile devices. Thanks
March 9, 201511 yr If you want the menu to just change appearance CSS media queries should be enough. If you want a toggle button to show/hide the menu you will need a little JavaScript function to change the display property of the menu. If you want dropdowns it can be done with CSS :hover but I will recommend JavaScript as hover-dropdowns can cause some problems on touch devices especially if the parent-menu item also is a link. In that case it has both a hover and (the default) click event attached and a touch device can only trigger one of the events.
March 10, 201511 yr You technically dont need any JavaScript. You can use a hidden checkbox with a linked label styled like a toggle button. You can then use the css :checked psudeo along with the adjacent child selector. That said I still prefer to use JS for mobile menu toggling. It's cleaner. I wrote about how to deal with dynamic navigation that works well with touch and mouse based devices http://rbrtsmith.com/2014/12/a-more-robust-dynamic-navigation-system/ Edited March 10, 201511 yr by rbrtsmith
March 10, 201511 yr Author Thanks a lot guys. I'll toy with a bit of JavaScript then. I'm not really familiar with it so it will be fun learning I'm sure
Create an account or sign in to comment