Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--Pattern HTML-->
  <div id="pattern" class="pattern">
    <!--Begin Pattern HTML-->
  	<a href="#menu" class="menu-link">Menu</a>
		<nav id="menu" class="menu" role="navigation">
			<ul class="level-1">
				<!--Parent #1-->
				<li class="has-subnav">
					<a href="#">Parent #1</a>
					<ul class="level-2">
						<li class="has-subnav">
							<a href="#">Child #1</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #2</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #3</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #4</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
					</ul>
				</li>
				
				<!--Parent #2-->
				<li class="has-subnav">
					<a href="#">Parent #2</a>
					<ul class="level-2">
						<li class="has-subnav">
							<a href="#">Child #1</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #2</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #3</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #4</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
					</ul>
				</li>

				<!--Parent #3-->
				<li class="has-subnav">
					<a href="#">Parent #3</a>
					<ul class="level-2">
						<li class="has-subnav">
							<a href="#">Child #1</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #2</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #3</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #4</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
					</ul>
				</li>

				<!--Parent #4-->
				<li class="has-subnav">
					<a href="#">Parent #4</a>
					<ul class="level-2">
						<li class="has-subnav">
							<a href="#">Child #1</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #2</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #3</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #4</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
					</ul>
				</li>
				
				<!--Parent #5-->
				<li class="has-subnav">
					<a href="#">Parent #5</a>
					<ul class="level-2">
						<li class="has-subnav">
							<a href="#">Child #1</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #2</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #3</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
						<li class="has-subnav">
							<a href="#">Child #4</a>
							<ul class="level-3">
								<li><a href="#">Grandchild #1</a></li>
								<li><a href="#">Grandchild #2</a></li>
								<li class="has-subnav">
									<a href="#">Grandchild #3</a>
									<ul class="level-4">
										<li><a href="#">Great-Grandchild #1</a></li>
										<li><a href="#">Great-Grandchild #2</a></li>
									</ul>
								</li>
							</ul>	
						</li>
					</ul>
				</li>

			</ul>
		</nav>
	</div>
	<!--End Pattern HTML-->
	
	<div class="container">	
		<section class="pattern-description">
			<h1>The Ol' Right to Left</h1>
      
      <p>From <a href="http://bradfrostweb.com/blog/web/complex-navigation-patterns-for-responsive-design/">Complex Navigation Patterns for Responsive Design</a>:</p>
Instead of sub-nav items appearing underneath the parent category like the multi-toggle, the next level of navigation is offscreen to the right and animates in when requested.</p>
<h3>Pros</h3>
<ul>
<li><strong>Sexy as hell</strong> &#8211; It&#8217;s not often you &#8216;ooo&#8217; and &#8216;aah&#8217; over navigation, but the right-to-left animation is certainly elegant.</li>
<li><strong>Follows mobile conventions</strong> &#8211; most major smartphone platforms have some form of right-to-left animation convention for drilling down into an experience. </li>
<li><strong>Scalable</strong> &#8211; Good for navigations that have a lot of levels. </li>
</ul>
<h3>Cons</h3>
<ul>
<li><strong>Complex</strong> &#8211; Not necessarily a con per se, but this pattern has a lot of (literal) moving parts. Just make sure to keep things accessible, cover your bases and test on as many different devices as possible.</li>
<li><strong>Animation performance</strong> &#8211; Animation performance varies greatly across different devices and platforms. Some mobile platforms handle animations just fine, while others are choppy as shit. And keep in mind that some platforms don&#8217;t support animation at all, so the sudden change in nav state may be jarring to the user.</li>
</ul>
<h3>In the Wild</h3>
<ul>
<li><a href="http://www.sony.com/index.php">Sony</a></li>
<li><a href="https://www.currys.co.uk/gbuk/index.html">Currys</a>
</ul>
    </div>
              
            
!

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');
		});
		
		});
              
            
!
999px

Console