LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

  
Menu

Multi-Toggle Navigation

From Complex Navigation Patterns for Responsive Design:

The multi-toggle is basically just nested accordions. The user taps on the parent category to reveal children categories underneath. Once enough screen real estate becomes available, they convert to the usual multi-level dropdown we’re used to seeing.

Quick tip: use one of two emerging icons: the plus sign (+) or downward caret (▼ ▼) to let users know there’s more content.

Pros

  • Scannable – users can quickly scan parent categories before making a decision to go to the next level.
  • Scalable – Got a menu that’s 17 levels deep? This solution can technically handle it with ease (but please don’t do that)

Cons

  • Not terribly sexy – tapping through a bunch of Russian nesting doll navigation levels isn’t the most elegant thing in the world, but then again I suppose you could say that about any multi-level navigation solution.
  • Potential JS requirement – I say ‘potential’ just because most accordion-style interactions I’ve seen uses JS to make the interaction happen. However, the brilliant Aaron Gustafson demonstrated that you can accomplish this effect using CSS’s :target pseudo-class. Pretty neat! Also, a JS requirement itself isn’t necessarily a con, just make sure the navigation is accessible for users with poor/no JS support.

Resources

In the Wild

CSS
a.menu-link {
  	    float: right;
		    display: block;
		    padding: 1em;
		}
		.menu, .menu > ul ul {
			clear: both;
			-webkit-transition: all 0.3s ease-out;  
			-moz-transition: all 0.3s ease-out;
			-ms-transition: all 0.3s ease-out;
			-o-transition: all 0.3s ease-out;
			transition: all 0.3s ease-out;
		}
		.js .menu, .js .menu > ul ul {
			overflow: hidden;
			max-height: 0;
			background: rgba(0,0,0,0.1);
		}
		.menu.active, .js .menu > ul ul.active {
			max-height: 55em;
		}
		.menu > ul {
			border-top: 1px solid #808080;
		}
		.menu li a {
			color: #000;
			display: block;
			padding: 0.8em;
			border-bottom: 1px solid #808080;
			position: relative;
		}
		.menu li.has-subnav > a:after {
			content: '+';
			position: absolute;
			top: 0;
			right: 0;
			display: block;
			font-size: 1.5em;
			padding: 0.25em 0.5em;
		}
		.menu li.has-subnav > a.active:after {
			content: "-";
		}
		
		
		@media screen and (min-width: 48.25em) {
			.pattern {
				overflow: visible;
			}
			a.menu-link {
			   display: none;
			}
			.js .menu, .js .menu > ul ul {
				max-height: none;
				overflow: visible;
				background: none;
			}
			.js .menu > ul ul {
				background: #808080;
				display: none;
			}
			.js .menu > ul li:hover > ul {
				display: block;
			}
			.menu ul {
				margin: 0 0 0 -0.25em;
				border: 0;
			}
			.menu li a {
				border: 0;
			}
			.menu li.has-subnav > a {
				padding-right: 2em;
			}
			.menu li.has-subnav > a:after {
				content: ">";
				font-size: 1em;
				padding: 0.8em 0.5em;
			}
			.menu .level-1 > li.has-subnav > a:after {
				content: "▼";
			}
			.menu > ul li {
				margin: 0 0.25em;
			}
			.menu > ul > li {
				display: inline-block;
				position: relative;
			}
			.menu > ul ul {
				position: absolute;
				top: 0;
				left: 12em;
				width: 12em;
			}
			.menu > ul ul li {
				position: relative;
			}
			.menu > ul ul.level-2 {
				top: 3em;
				left: 0;
			}
		}
JS
$(document).ready(function() {
  	  $('body').addClass('js');
		  var $menu = $('#menu'),
		  	  $menulink = $('.menu-link'),
		  	  $menuTrigger = $('.has-subnav > a');
		
		$menulink.click(function(e) {
			e.preventDefault();
			$menulink.toggleClass('active');
			$menu.toggleClass('active');
		});
		
		$menuTrigger.click(function(e) {
			e.preventDefault();
			var $this = $(this);
			$this.toggleClass('active').next('ul').toggleClass('active');
		});
		
		});

Description

The multi-toggle is basically just nested accordions. The user taps on the parent category to reveal children categories underneath. Once enough screen real estate becomes available, they convert to the usual multi-level dropdown we’re used to seeing.
Term
Mon, 11/27/2017 - 21:21

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv