http://hipertextos.github.io/src/css/styles.css
Responsive menu: collapse on small screens
Pure CSS using checkboxes
Sample
Resize the window to see the effect
Markup
<nav> <input class="toggletrigger" type="checkbox" id="mob-nav" name="mob-nav" aria-hidden="true" hidden> <label for="mob-nav" class="toggle">Menú <span class="caret"></span></label> <div class="togglecollapsed"> <a href="url" title="title">Item</a> ... </div> </nav>
With a bit of jQuery
Sample
Markup
<nav> <label class="toggle">Menú <span class="caret"></span></label> <div id="nav-collapse"> <a href="url" title="title">Item</a> <a href="url" title="title">Item</a> <a href="url" title="title">Item</a> <a href="url" title="title">Item</a> <a href="url" title="title">Item</a> </div> </nav> <script> // Collapse horizontal nav in small devices $('#nav-collapse').toggleClass('nav-collapsed'); $('nav .toggle').click(function(){ $('#nav-collapse').toggleClass('nav-collapsed'); }); </script>