Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                <!-- This is my responsive solution to big sass Menus -->
<!-- Inspired by Brad Frost and MegaMenus --> 

<!-- Navigation --> 
	<div class="nav wrapper"> 
		<div class="container"> 	
		<nav> 
			<span> <a href="#" class="menuToggle"> MENU  <i class="icon-caret-down"> </i> </a> </span> 		
			<ul>
				<li><a href="https://www.google.com">Google Link</a> <i class="icon-caret-down subMenuToggle" tabindex="1"> </i> 
					<div class="menuSub"> 
						<div class="menuSub-inner">
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Top Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						</div> 
					</div> 
				</li>
				<li><a href="#">Parent Link</a> <i class="icon-caret-down subMenuToggle"> </i> 
					<div class="menuSub"> 
						<div class="menuSub-inner">
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Child Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						  <div class="menuCols">
						  		<ul> 
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  			<li><a href="#">Links</a></li>
						  		</ul> 
						  </div> 
						</div> 
					</div> 
				</li>
				<li><a href="#">Research</a></li>
				<li><a href="#">Designs</a></li>
				<li><a href="#">Another Big Link Title</a></li>
				<li><a href="#">Stuffage</a></li>
				<li><a href="#">Donate</a></li>
			</ul>
		</nav> 
		</div>
	</div> 
<!-- End Navigation --> 
<h2> Documentation </h2> 
<p> Realtively Untested as far as browser and device compatability.  That will be later for me, but this can get anyone a good start that has an extremely large menu that needs to be responsive.  I encourage forking and feel free to use this script as you might need.  If you adapt and use it I would love to see what it looks like in the end, but it is not a requirement.  Also want to thank <a href="http://www.fourfront.us/blog/jquery-window-width-and-media-queries"> Chris Arasin for his blog post </a> showing a different way to hook up responsive jquery. </p>
<h2> Inspiration </h2> 
<p> This menu came because we have giant menus in the higher education realm.  With 20-30% of our traffic being mobile we had to make a responsive design.  The challenge of being more accessible is also on the plate although I haven't tested this enough yet I believe with Aria Roles I can make this menu much more accessible. </p> 

  <h3> Adobe Menu </h3> 
<p> The <a href="http://www.adobe.com/"> adobe menu </a> was a nice option, but I didn't like the way that certain links just disappeared.  
</p>

 <h3> CoDrops Blueprints </h3> 
<p> The <a href="https://tympanus.net/codrops/2013/03/05/horizontal-drop-down-menu/"> blueprint dropdown </a> also was a nice solution, but the unclickable toplevel links wasn't as accessible in my opinion.  After all a click is an intent to go to that page.   
</p>

<h3> Brad Frost Responsive Patterns </h3> 
<p> The <a href="https://codepen.io/micahgodbolt/full/czwer"> responsive pattern codepen </a> inspired the way to handle the children links in responsive view without taking up too much precious realestate.   
</p>

<p><strong> Enjoy!</strong></p>
 


<div class="edit">
<h3> Edit </h3>  
<h4> 12.23.2013 </h4> 
  
  <p>Recent Change in the laptop function to allow hover and click binding making the menu more accessible and able to use the tab key to traverse the menu. </p> 
</div> 




              
            
!

CSS

              
                @import "compass/css3";

// Attached Font Awesome Icons 
// Sass Breakpoint Mixin
@mixin breakpoint($break) {
    @if $break == laptop {
        @media (min-width: 60em) { @content; }
    }
}

// Color Variables  
$bg-color:#0079c1;

// Universal Box Sizing for width and padding adjustments 
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box; }

body {
  font-size: 100%;
  line-height: 1.5;
  margin: 0;
  font-weight: 300; }
h2, h3, h4 { padding:10px 20px 0; margin:0; }
h4 {color:grey;}
p { padding:0 20px; }

.edit { margin:10px; background:rgba($bg-color,.3); border: 1px solid $bg-color; 
  h3, h4 { font-size:1.3em; margin:0; display:block; color:#000; width:50%; float:left; }
  h4 {text-align:right;} 
}
  
.wrapper { 
    width:100%; 
    background:$bg-color; 
    margin:0  auto; 
    *zoom: 1; // IE }

.container { 
  margin: 0 auto;  
  *zoom:1; // IE 
  max-width:80em; }

.nav { 
	@include box-shadow(inset 0 0 4px rgba(0,0,0,.5)); 
	margin:0; 
	padding:0;
    @include breakpoint(laptop) { position:relative; }}

.active { display:block !important; } 

nav { 
  width: 100%;
  margin: 0;
  padding: 0; 
    span {
    	width:100%;
    	background:$bg-color;
      border-bottom:1px solid darken($bg-color,10%); 
		display:block;
    	@include breakpoint (laptop) { display:none; }
    a { 
      width: 100%;
      background:$bg-color;
      display: block;
      padding: 10px;
      font-size: 1.2em;
      color: #fff;
      &:active,visited { color:#fff; }  
      &:hover,focus { color:#eee; } 
      i{ float:right;}
    }}
}

nav { 
  ul { 
		margin:0; 
		padding:0; 
		list-style:none; 
		text-transform:uppercase;
		font-size:16px;
    background:$bg-color;
		@include breakpoint (laptop) { font-size:15px;}
			 > li {
			 	position:relative;
    			border-bottom: solid 1px darken($bg-color, 10%);
    			margin:0;
    			padding:10px 0;
    				@include breakpoint(laptop) { 
    						position:static;
      						display:inline-block;
      						padding:10px 12px;
      						border-bottom:none;}
    			> a {
      				color:#fff;
              display:block;
      				font-weight:500;
      				letter-spacing:1px;
      				text-decoration: none;
      				text-align: left;
      				padding-left:10px;
      				padding-right:30%;
      				@include breakpoint(laptop) { display:inline-block; padding:0;}
    				&:hover,focus { text-decoration:underline; }}
    				i { 
    					position:absolute; 
              color:#fff;
    					right:0; 
    					top:0; 
    					padding:14px;
    					&:hover,focus { 
                			text-decoration:underline; 
               				background:rgba(#000,.2); 
                			cursor:pointer;}}
 			.menuSub { 
    	 	position:relative; 
    	 	top:9px;
       	border-top: 2px solid darken($bg-color,10%);
    	 	//background:lighten($bg-color,15%);
    	 		@include breakpoint(laptop){    	
    				position:absolute;
    				padding:10px;
    				width:100%; 
					margin:0 auto; 
					left:0; 
					top:42px;
					background:rgba($bg-color, .9); }
    	 	ul { margin:0; padding:0; background:none; }
    	 		li { border-bottom:0; margin-top:2px; background:lighten($bg-color,10%); 
    	 			@include breakpoint (laptop) { width:100%; background:none; }
    	 			a {color:#333; @include breakpoint(laptop) { color:#fff; @include text-shadow(1px 1px 2px darken($bg-color,20%)); }}}}
    	 	.menuSub-inner { 
    	 				max-width:60em; 
						margin:0 auto; 
						font-size:1em;
						position:relative;}
			.menuCols { 
					width: 100%;
         			margin-left: 0;
          			margin-right: 0;
          			clear: none;
					@include breakpoint (laptop) { 
            width: 32.20339%;
              				clear: right;
             				float: left;
              				margin-left: 0%;
              				margin-right: 1.69492%;
          					&:last-of-type { margin-right:0;}}}
      }}}}
              
            
!

JS

              
                // Declare Variables to use in Menu Scripts 
var $parentItems = $('nav > ul > li'),
    $parentLinks = $parentItems.children('a'),
    $parentToggles = $('.subMenuToggle'),
	$menu = $('nav ul'),
	$menuSub = $('.menuSub'),
	winWidth = $(window).width();

// Declare Mobile Menu Function 

var mobileMenu = function() {

    // If less than 960px Window Width then Run this stuff 
    $menu.css('display', 'none'); // Hide Navigation Except for MenuToggle 
    $menuSub.css('display', 'none'); // Hide SubNav
    $parentToggles.css('display', 'block'); // Make Sure that the Toggles Come Back if Responsive 
    $parentItems.unbind('hover mouseover mouseleave'); // Remove Hover Function to the Parent Items for Resizing
    $parentToggles.bind('click'); // Add Click Functionality to the Toggles

    // Toggle the Main Menu 
    $('.menuToggle').click(function(e){
        e.preventDefault();
        $('nav ul').toggleClass('active');
        event.stopPropagation();
    });
    // AdditionalSubMenu Tabs	
    $parentToggles.click(function(e){
        e.preventDefault();
        $(this).next('.menuSub').stop(true, true).toggleClass('active');
    });
};

var laptopMenu = function() {
    // If greater than 960px Window Width then Run this stuff 
    $menu.css('display', 'block'); // Hide Navigation Except for MenuToggle 
    $menuSub.css('display', 'none'); // Hide SubNav
    $parentToggles.css('display', 'none'); // Make Sure that the Toggles Come Back if Responsive 
    $parentToggles.unbind('click'); // Remove Click Functionality to the Toggles
            
    $parentItems.on('mouseenter focusin',
  		function() {
  			if ($('nav span').css('display') === 'none'){ // Test Browser Size Deactivates hover mobile
  				$(this).addClass( "hover" );
    			$('.menuSub', this).addClass('active'); 
    		}
  		});  
  		
  	$parentItems.on('mouseleave focusout',
  		function() {
  			if ($('nav span').css('display') === 'none'){ 
    			$( this ).removeClass( "hover" );
    			$('.menuSub', this).removeClass('active');
    		}
  		});
    
};

// Make the Responsive Menu Work From A User on Stack Overflow 

function debouncer(func,timeout){
   var timeoutID , timeout = timeout || 200;
   return function () {
      var scope = this , args = arguments;
      clearTimeout( timeoutID );
      timeoutID = setTimeout( function () {
          func.apply( scope , Array.prototype.slice.call( args ) );
      } , timeout );
   }
}


// Resize Functions
$(window).resize(debouncer(function(e){
	if ($('nav span').css('display') === 'block'){
		mobileMenu(); 
	}
	else if ($('nav span').css('display') === 'none'){
		laptopMenu(); 
	}
}));


// Document Ready
$(document).ready(function () {
    // Document Ready Functions 
    $('a').attr({'tabindex': '1' });
    
    if ($('nav span').css('display') === 'block'){
		mobileMenu(); 
	}
	else if ($('nav span').css('display') === 'none'){
		laptopMenu(); 
	}
});
              
            
!
999px

Console