nav menu
by dafin defandaky
HTML
<ul class="nav">
<li id="beranda">
<a href="#">DBD</a>
</li>
<li>
<a href="#">Tentang</a>
</li>
<li id='label'>
<a href="#">Alat</a>
<ul class='subnav'>
<li>
<a href='/p/generator-kode-warna.html'>
Kode Warna
</a>
</li>
<li>
<a href='/svn/trunk/Lipsum-UI/index.html'>
Generator Teks
</a>
</li>
<li>
<a href='/svn/trunk/CSS3ButtonGenerator-V3/index.html'>
Generator Tombol
</a>
</li>
<li>
<a href='/svn/p/css-compressor-and-beautifier.html'>
Kompresor CSS
</a>
</li>
</ul>
</li>
<li>
<a href="#" title='defandaky'>Isi</a>
</li>
<li id="search">
<form id="search-form" action="/search" method="get">
<span id='db-search_text'><input type="text" name="q" autocomplete="off" id="search_text" placeholder="Cari disini..."/><span class="bersih">×<span class='tooltip b'>
Bersihkan!
</span></span></span>
<input type="submit" value="" name="search_button" id="search_button"/>
</form>
</li>
<li id="label">
<a href="#">Label</a>
<ul class="subnav">
<li><a href="#">CSS</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">HTML</a></li>
<li><a href="#">Javascript</a></li>
</ul>
</li>
<li>
<a href="#" title='defandaky'>OOT</a>
</li>
</ul>
CSS
@import url(http://fonts.googleapis.com/css?family=Montserrat);
* {
margin: 0;
padding: 0;
}
.nav {
background: #232323;
height: 60px;
display: inline-block;
width:100%;
}
.nav li {
float: left;
list-style-type: none;
position: relative;
}
.nav li a {
font-size: 16px;
color: white;
display: block;
line-height: 60px;
padding: 0 26px;
text-decoration: none;
border-left: 1px solid #2e2e2e;
font-family: Montserrat, sans-serif;
text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}
.nav li a:hover {
background-color: #2e2e2e;
}
#beranda a {
padding: 18px;
height: 24px;
font-size: 22px;
line-height: 24px;
color:#369;
}
#search {position: relative;
width: 337px;
margin: 4px;
}
#search_text{
width: 277px;
padding: 15px 35px 15px 10px;
font-size: 16px;
font-family: Montserrat, sans-serif;
border: 0 none;
height: 52px;
margin-right: 0;
color: #fff;
outline: none;
background: #368;
float: left;
box-sizing: border-box;
transition: all 0.15s;
}
.bersih{ position: relative;visibility:hidden;cursor:pointer;padding:20px 0;color:#368;font-size: 37px;font-weight:bold;margin-left:-90px}
::-webkit-input-placeholder { /* WebKit browsers */
color: white;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: white;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: white;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: white;
}
#search_text:focus {
background: #fff;color:#369;
}
#search_button {
border: 0 none;
background: #369 url(http://3.bp.blogspot.com/-n7ego5_xMGk/VL2XPSfntEI/AAAAAAAACjI/2DuSYbZXwzc/s1600/search.png) center no-repeat;
width: 60px;
float: left;
padding: 0;
text-align: center;
height: 52px;
cursor: pointer;
}
#search_button:hover{background: #368 url(http://3.bp.blogspot.com/-n7ego5_xMGk/VL2XPSfntEI/AAAAAAAACjI/2DuSYbZXwzc/s1600/search.png) center no-repeat;}
#search_button:active{background: #900...
JavaScript
(function() {
var searchForm = document.getElementById('search-form'),
textInput = searchForm.q,
clearBtn = textInput.nextSibling;
textInput.onkeyup = function() {
clearBtn.style.visibility = (this.value.length) ? "visible" : "hidden";
};
clearBtn.onclick = function() {
this.style.visibility = "hidden";
textInput.value = "";
};
$('.bersih').on("mouseenter", function (){
$(".tooltip.b").animate({},4000, 'easeInOutExpo' ).fadeIn('slow');
}).on("mouseleave", function (){
$(".tooltip.b").animate({},4000, 'easeInOutExpo').fadeOut('slow');
});
})();