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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

<link href='https://fonts.googleapis.com/css?family=Anton' rel='stylesheet' type='text/css'>
   

<div id="fixed"> 
       <div id="search-wrap" class="wrap-top search-wrap">
          <div class="width">
              <ul class="clearfix">
                    <li ><i class="fa fa-search"></i> <input type='search' placeholder="Search..."></li>
                    <li id="li-3">Search</li>
                    <li id="li-4"> <i class="fa fa-times"></i> </li>
                </ul>
          </div>
       </div> 
       
        <div id="tags-wrap" class="wrap-top tags-wrap">
          <div class="width">
              <ul class="clearfix">
                   <li>tag#1</li>
                   <li>tag#2</li> 
                   <li>tag#3</li> 
                   <li>tag#4</li> 
                   <li>tag#5</li>
                   <li>tag#6</li>
                   <li>tag#7</li>
                   <li>tag#8</li>
                   <li>tag#9</li>
                   <li>tag#10</li>  
              </ul>
              <div id="search-results"></div>
          </div>
       </div> 
        
       <div id="nav-wrap" class="wrap-top nav-wrap">
           <div class="width">
                <ul class="clearfix">
                    <li>Link#1<span>Sub-link#1</span></li>
                    <li>Link#2<span>Sub-link#2</span></li>
                    <li>Link#3<span>Sub-link#3</span></li>
                    <li>Link#4<span>Sub-link#4</span></li>
                    <li>Link#5<span>Sub-link#5</span></li>
                    <li>Link#6<span>Sub-link#6</span></li>
                    <li id="search-btn" class="s-desk"> <i class="fa fa-search"></i> </li>
                </ul>
                
                <i class="fa fa-reorder fa-2x menu-mob" id="menu-mob"></i>
                
            </div>
        </div>
    </div>
    
  	
    <div id="content-wrap">    
        <div class="row"  id="first-row" data-color="#2c3e50">
            <div class="width">
                <h1>Menu + Animated Search Box</h1>
                <h2>A Pen by <a href="http://www.andrecortellini.com" target="_blank"><span>André Cortellini</span></a></h2>
            </div>
            <i class="fa fa-angle-double-down fa-2x"></i>
        </div>
        
        <div class="row" data-color="#33475C">        
        	<div class="width">
                <ul>
                    <li><i class="fa fa-check"></i> Sleek Search Box</li>
                    <li><i class="fa fa-check"></i> Smart Scroll</li>
                    <li><i class="fa fa-check"></i> Elastic Design</li>
                    <li><i class="fa fa-check"></i> Fully Responsive</li>
                    <li><i class="fa fa-check"></i> Minimal Design  </li>
                </ul>
            </div>
        </div>
        
        <div class="row" data-color="#3A5269">        
        </div>
        
        <div class="row" data-color="#415C76">        
        </div>
    </div>
              
            
!

CSS

              
                /*CLEARFIX*/
.clearfix:after {content: ".";	display: block;	clear: both; visibility: hidden; line-height: 0; height: 0;} 
.clearfix {	display: inline-block;} 
html[xmlns] .clearfix {display: block;} 
* html .clearfix {height: 1%;}

/*CSS RESET*/
html,body,div,span,applet,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
a,abbr,acronym,address,big,cite,code,
del,dfn,em,img,ins,kbd,q,s,samp,
small,strike,strong,sub,sup,tt,var,
b,u,i,center,
dl,dt,dd,ol,ul,li,
fieldset,form,label,legend,
table,caption,tbody,tfoot,thead,tr,th,td,
article,aside,canvas,details,embed,
figure,figcaption,footer,header,hgroup,
menu,nav,output,ruby,section,summary,
time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}

/* HTML5 display-role reset for older browsers */
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section{display:block;}
body{line-height:1;}
ol,ul{list-style:none;}
blockquote,q{quotes:none;}
blockquote:before,blockquote:after,
q:before,q:after{content:'';content:none;}
table{border-collapse:collapse;border-spacing:0;}

/*GLOBALS*/
a{text-decoration:none;	}
body, hmtl{background: #2c3e50; font-family: 'Anton', sans-serif;}


/*WRAPPERS*/
#fixed{
	position:fixed;
	z-index:1000;
	width:100%;	
	top:0;
}
.wrap-top{
	height:70px;
	width:100%;	
	line-height:70px;
}

.wrap-top ul{
	position:relative; 
	width:100%;
	height:100%;
}

.wrap-top ul li{
	float:left;
	list-style:none;
	text-align:center;
	text-transform:uppercase;
	font-size:21px;	
	
	-webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
	
	height:100%;
}
.width{
	max-width:800px;
	width:100%;
	margin: 0 auto;
	height:100%;
}





/*SEARCH*/
#search-wrap{background:#253444;}

.search-wrap{margin-top:-70px;}
.search-wrap.active{margin-top:0;}

#search-wrap ul li{
	width:75%;
	color:#3b5167;
	height:70px;		
	border-right: 1px solid #3b5167 ;
}

#search-wrap ul li:first-child{
	border-left: 1px solid #3b5167 ; 
	position:relative; 
}

#search-wrap ul li:first-child i{
	position:absolute;
	top:23px;
	left:3.5%;
	color:#3b5167;	
}
#search-wrap #li-3{width:15%; cursor:pointer; font-size:18px; color:#97a5b5;}
#search-wrap #li-4{	width:10%; cursor:pointer;}
#search-wrap #li-3:hover, #search-wrap #li-4:hover{	background:#2c3e50;	color:#fff;}

/*Input*/
#search-wrap input{
	text-align:left;
	width:100%;
	height:100%;
	border:none;
	outline:none;
	padding:4% 4% 4% 10%;	
	background:none;
	color:#fff;
	font-size:36px;
	 font-family: 'Anton', sans-serif;
}

#search-wrap input:focus{	background:#2c3e50;}

input[type='search']::-webkit-search-decoration, 
input[type='search']::-webkit-search-cancel-button, 
input[type='search']::-webkit-search-results-button, 
input[type='search']::-webkit-search-results-decoration {
	display: none;
}

#search-wrap input::-webkit-input-placeholder{ color:#3b5167; opacity:1;}
#search-wrap input:-moz-placeholder{color:#3b5167; opacity:1;}
#search-wrap input::-moz-placeholder{color:#3b5167; opacity:1;}
#search-wrap input:-ms-input-placeholder {color:#3b5167; opacity:1;}




/*NAV*/
.menu-mob{display:none !important;}
#nav-wrap{	background:#fff; line-height:64px;}

.nav-wrap.active, .nav-wrap.active li{	height:50px;	line-height:50px;}
.nav-wrap.active ul li#search-btn{	line-height:50px !important;}
.nav-wrap.active ul li:before{display:none;}
.nav-wrap.active ul li span{display:none;}

#nav-wrap ul li{
	width:15%;
	cursor:pointer;
	color:#3b5167;	
	border-right: 1px solid #cad0d6 ;
	position:relative;
}

#nav-wrap ul li:first-child{border-left: 1px solid #cad0d6 ;}

#nav-wrap ul li#search-btn{
	width:10%; 
	line-height:70px;
}

#nav-wrap ul li:hover, 
#nav-wrap ul li.active {	
	color:#FFF;	
	background:#2c3e50;
}

/*sub*/
.nav-wrap ul li span{
	display:block;
	line-height:0;
	font-size:9px;
	position:relative;
	top:-12px;	
	color:#415C76;
	font-family:Arial, sans serif;
}




/*TAGS*/
.tags-wrap{
	height:0px;
	background:#3b5167;	
	overflow:hidden;
}

.tags-wrap.active{
	height:50px;	
}

.tags-wrap ul li{
	font-size:12px;
	color:#707f91;
	background:#2c3e50;
	line-height:20px;
	height:auto;
	padding:2px 0;
	width:8%;
	margin:0 1%;
	font-family:Arial, sans serif;
	text-transform:lowercase;
	cursor:pointer;
	font-weight:bold;
	opacity:0.8;
}

.tags-wrap ul li:hover{
opacity:1;	
color:#97a5b5;
}

#search-results{
text-align:center;
color:#fff;	
font-family:Arial, sans serif;
height:50px;
line-height:50px;
}

#search-results span{
font-weight:bold;	
}







/*CONTENT*/
#content-wrap{width:100%; margin-top:70px;}

h1, h2{
	color:#fff;
	text-align:center;	
	
	-webkit-transition: all 0.5s ease;
	-moz-transition:    all 0.5s ease;
	-o-transition:      all 0.5s ease;
	-ms-transition:     all 0.5s ease;
	transition:         all 0.5s ease;	
}

h1{	font-size:36px;}
h2{
	font-size:16px;	
	margin:15px 0 0px; 
	color:#97a5b5; 
	font-family:Arial, sans-serif;	
}

.row{
	width:100%;
	padding:50px 0px;
	font-size:18px;
	color:#999;
	position:relative;
	height:180px;
}

.row.active, h2 span{color:#fff;}
.row.active{background:#3c3c3c;}

#first-row{height:auto; position:relative;}
#first-row i{
	position:absolute;
	left:50%;
	margin-left:-12px;
	bottom:-20px;
	z-index:100;
}

#first-row i.active{
	-moz-transform: rotate(-180deg);
	-webkit-transform: rotate(-180deg);
	-o-transform: rotate(-180deg);
	-ms-transform: rotate(-180deg);
	transform: rotate(-180deg);	
}

.row ul{
display:block;
width:185px;
margin: 0 auto;	
}

.row li{
	color:#fff;
	font-family:Arial, sans serif;
	margin-bottom:20px;
}

.row .fa{
	color:#97a5b5;
		
}




/*ANIMATION*/
.search-wrap, .tags-wrap, .nav-wrap, #first-row i{
	-webkit-transition: all 0.3s cubic-bezier(0, .68, .07, 1); 
	-moz-transition: all 0.3s cubic-bezier(0, .68, .07, 1); 
	transition: all 0.3s cubic-bezier(0, .68, .07, 1);
	-ms-transition: all 0.3s cubic-bezier(0, .68, .07, 1);	
}

/*scale down*/
h1, h2{
	-moz-transform: scale(0);
	-webkit-transform:  scale(0);
	-o-transform:  scale(0);
	-ms-transform: scale(0);
	transform:  scale(0);
	opacity:0;
}

/*animation active*/
h1.animationActive, h2.animationActive {
	-moz-transform: scale(1);
	-webkit-transform:  scale(1);
	-o-transform:  scale(1);
	-ms-transform: scale(1);
	transform:  scale(1);
	opacity:1;
}



/*RESPONSIVE*/
@media screen and (max-width: 500px){

/*NAV*/
.width{position:relative;}
.menu-mob{
	display:block !important;
	position:absolute;
	left:0;
	top:0px;
	height:50px;
	width:15%;
	border-right: 1px solid #cad0d6 ;
	text-align:center;
	line-height:50px !important;
	color:#3b5167;
	cursor:pointer;
}

.menu-mob:hover, menu-mob.active{
	background:#2c3e50;
	color:#fff;	
}

#nav-wrap ul li{	
	width:100%;	
	background:#1D2835;
	-webkit-transition: all 0.3s cubic-bezier(0, .68, .07, 1); 
	-moz-transition: all 0.3s cubic-bezier(0, .68, .07, 1); 
	transition: all 0.3s cubic-bezier(0, .68, .07, 1);
	-ms-transition: all 0.3s cubic-bezier(0, .68, .07, 1);
	position:absolute;
	top:-2000px;
}

#nav-wrap ul li.mob{
	position:static;	
}

#nav-wrap ul{	margin-top:50px;	height:auto;}
#nav-wrap ul li#search-btn{
	position:absolute;
	right:0;
	width:15%;
	top:-50px;
	height:50px;
	line-height:50px;
	background:#fff;
	border-left: 1px solid #cad0d6 ;
	
}
#nav-wrap ul li#search-btn:hover{	background:#2c3e50;}
.nav-wrap.active ul{	margin-top:50px !important;}
.nav-wrap{height:50px;}

/*SEARCH*/
#search-wrap ul li:first-child{	width:60%; font-size:}
#search-wrap #li-3{width:25%;}
#search-wrap #li-4{width:15%;}
#search-wrap input{font-size:24px; padding: 4% 4% 4% 18%;}
#search-results{line-height:100px;}

/*TAGS*/
.tags-wrap.active{
height:100px;	
}
.tags-wrap ul li{
	width: 30%;
	margin: 0 1.5%;
	margin-top: 6px;
	padding: 2px 0;	
}
}


              
            
!

JS

              
                
$(document).ready(function(){

	/******************************
	 ADD ANIMATION TO THE TEXT 
	******************************/
	animation()	
	
	
	/*********************
	 SET ROW'S COLOR
	*********************/
	$.each($('.row'), function() { 
	   var c = $(this).attr("data-color");
	   $(this).css("background",c);
	});
	
	
	
	
	/******************
	 SEARCH BOX
	******************/
	var input = $('#search-wrap input');
	var sw = $('#search-wrap');
	var tw = $('.tags-wrap');
	var sr = $('#search-results');
	
	//show the search box
	$('#search-btn').click(function(){
		sw.addClass('active');
		input.focus();
	});	
	
	//close the search box
	$('#content-wrap, #li-4').click(function(){
		//collapse bars
		fcollapse(sw,tw)
		
		//reset search
		input.val("");
		nsearch(sr)	
		
	});
	
	//key up function
	input.keyup(function(e){
		tw.addClass('active');
		
		//if input is 'EMPTY'
		if($(this).val().length == 0){
			tw.removeClass('active');			
			nsearch(sr)	
		}
		
		//if we press 'ENTER'
		if (e.keyCode == 13) {
		    fsearch(input, sr, tw)
	    }
		
		//if we press 'BACKSPACE'
		if (e.keyCode == 8) {
		   nsearch(sr)
	    }
	});
	
	
	
	/*TAGS CLICK*/
	$('.tags-wrap ul li').click(function(){
		var txt = $(this).text();
		input.val(txt);
		input.focus();		
	});
	
	
	/*SEARCH CLICK*/
	$('#li-3').click(function(){
		fsearch(input, sr, tw)
	});
	
	
	
	
	
	
	
	/*************************
	 ON WINDOW SCROLL FUNCTION
	*************************/
	var count = 0;
	$(window).scroll(function(event){		

		var scrolled = $(this).scrollTop();		
		
	    if (scrolled > count){  
			//scroll down
			count++;
			$('#nav-wrap').addClass('active');		
		} 
		else { 			
			//scroll up
			count--; 
			$('#nav-wrap').removeClass('active');
		}
	    
		//Check if we've reached the top
		count = scrolled;		
		
		if(count == 0){
			animation()
			$('#first-row i').removeClass('active');
		}else{
			$('h1 ,h2').removeClass('animationActive');
			$('#first-row i').addClass('active');
		}
		
		if(count == 200){
			//collapse
			fcollapse(sw,tw)
		}
	
	});
	
	
	/*****************
		MOBILE
	*****************/
	var mob = $('#menu-mob');
	mob.click(function(){
		$(this).toggleClass('active');
		$('#nav-wrap ul li').toggleClass('mob');
	});	

});//DOCUMENT READY
	
	
	
	
/*Animation Text*/
function animation(){
	$('h1').addClass('animationActive');
	
	var count = 0;
	var limit = 10;
	
	var interval = setInterval(function(){
       count++;
	   if (count === limit) { 
	   		clearInterval(interval);			
			$('h2').addClass('animationActive');	
		}
	}, 50);	
}



/*Collapse Bars Function*/
function fcollapse(sw, tw){
	sw.removeClass('active');
	tw.removeClass('active');	
}



/*Search Function*/
function fsearch(input, sr, tw){
	var r = input.val();
	$('.tags-wrap ul').css('display', 'none');
	sr.html('Sorry, 0 results were found for: <span> "' + r + '"</span>');
	tw.addClass('active');	
}



/*Clear/New function*/
function nsearch(sr){
	sr.html('');
	$('.tags-wrap ul').css('display', 'inline-block');
}
	
	
	
	
              
            
!
999px

Console