Responsive Navigation Menu CSS & Javascript

http://goo.gl/7vVcM5

by Emmanuel Garcia

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<nav>
	<div class="btn">
    </div>
	<ul>
        <li><a href="index.html" class="menu" >INICIO</a></li>
        <li><a href="nosotros.html" class="menu" >NOSOTROS</a></li>
        <li><a href="productos.html" class="menu" >PRODUCTOS</a></li>
        <li><a href="servicios.html" class="menu" >SERVICIOS</a></li>
        <li><a href="contacto.html" class="menu" >CONTACTO</a></li>
    </ul>
    
</nav>

CSS

* {
	margin: 0;
	}

html {
    font-size: 100%; /* 1 */
    -webkit-text-size-adjust: 100%; /* 2 */
    -ms-text-size-adjust: 100%; /* 2 */
}


nav {
	height: 40px;
	width: 100%;
	background: #054988;
	font-size: 11pt;
	font-family: 'PT Sans', Arial, sans-serif;
	position: relative;
}

nav a {
	color: #fff;
	display: inline-block;
	width: 100px;
	text-align: center;
	text-decoration: none;
	line-height: 40px;
	/*text-shadow: 1px 1px 0px #283744;*/
}

nav header {
	display: none;
		
}

nav ul {
	padding: 0;
	margin: 0 auto;
	width: 100%;
	height: 40px;
}
nav li {
	display: inline;
	float: left;
}

nav li a {
	border-right: 1px solid #FFF;
	box-sizing:border-box;
	-moz-box-sizing:border-box;
	-webkit-box-sizing:border-box;
}


nav li:last-child a {
	border-right: 0;
}
nav a:hover, nav a:active {
	background-color: #4377C0;
}


/*Styles for screen 600px and lower*/
@media screen and (max-width: 600px) {
	nav { 
  		height: auto;
		
  	}
	
	nav header {
	display: none;
		
}
	
  	nav ul {
  		width: 100%;
  		display: block;
  		height: auto;
		
  	}
  	nav li {
  		width: 50%;
  		float: left;
  		position: relative;
  	}
  	nav li a {
		border-bottom: 1px solid #FFF;
		border-right: 1px solid #FFF;
	}
  	nav a {
	  	text-align: left;
	  	width: 100%;
	  	text-indent: 25px;
		background: #054988;
  	}
}

/*Styles for screen 515px and lower*/
@media only screen and (max-width : 480px) {
	nav {
		border-bottom: 0;
		background: #054988;
		width: 100%;
		height: 33px;
		padding: 7px 0 0 0;
		
	}
	
	
		
	nav ul {
		display: none;
		height: auto;
		padding: 10px 0 0 0;
		clear: both;
		background: #4377C0; 
	
	}
	
	.btn {
		width: 24px;
		height: 22px;
		background: #4377C0;
		float: left;
		cursor: pointer;
		margin: 0 10px 0 10px;
		padding: 3px 0px 0 6px;
		-webkit-border-radius: 2px;
     	-moz-border-radius: 2px;
          border-radius: 2px;
		background:url('http://3.bp.blogspot.com/-EznzkHBnKbk/Up4icD70ujI/AAAAAAAADYA/BzRSsyl-5y0/s20/menu-responsive.png')...

JavaScript

$(function() {
			var pull 		= $('.btn');
				menu 		= $('nav ul');
				menuHeight	= menu.height();

			$(pull).on('click', function(e) {
				e.preventDefault();
				menu.slideToggle();
			});

			$(window).resize(function(){
        		var w = $(window).width();
        		if(w > 320 && menu.is(':hidden')) {
        			menu.removeAttr('style');
        		}
    		});
		});