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 Carousel+</h1>
      
      <p>From <a href="http://bradfrostweb.com/blog/web/complex-navigation-patterns-for-responsive-design/">Complex Navigation Patterns for Responsive Design</a>:</p>
This is a funky one. The carousel+ pattern is a carousel containing the parent category with the sub-nav options displayed below. The user can horizontally swipe through the available navigation options or use the right and left arrows to move through the carousel.</p>
<h3>Pros</h3>
<ul>
<li><strong>Relatively sexy</strong> &#8211; This is certainly a unique and elegant solution for complex navigation.</li>
<li><strong>Plays well with touch screens</strong> &#8211; the ability to swipe through a little carousel is a pretty cool interaction and is decently efficient at getting you where you need to go.</li>
</ul>
<h3>Cons</h3>
<ul>
<li><strong>Doesn&#8217;t expose all parent categories at once</strong> &#8211; Like the Priority+ pattern, the Carousel+ pattern requires interaction to occur before the user can understand what options are available to them.</li>
<li><strong>Cumbersome for non-touch devices</strong> &#8211; a swipe-enabled carousel is great, but there&#8217;s still a lot of environments and devices that don&#8217;t support javascript touch events. For those environments, the user has to resort to arrows that advance one category at a time, which can be quite tedious.</li>
<li><strong>Not conducive for multi-level navigations</strong> &#8211; This pattern can work if you have only one level of sub-navigation, but doesn&#8217;t scale beyond that.</li>
<li><strong>Weird proximity issues between main navigation and sub-nav</strong> &#8211; There&#8217;s a bit of detachment between the first level nav items and sub-nav items that doesn&#8217;t quite feel right. Maybe it&#8217;s just me.</li>
</ul>
<h3>In the Wild</h3>
<ul>
<li><a href="http://m.intel.com/content/intel-us/en.touch.html">Intel&#8217;s mobile site</a> &#8211; Yes I know it&#8217;s not responsive, but that doesn&#8217;t mean this pattern can&#8217;t be used in a responsive environment.</li>
</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