MenuHighlight
HTML
<nav>
<ul id="h">
<li class="selected"><a href="#1">Menu Item 1</a></li>
<li><a href="#2">Menu Item 2</a></li>
<li><a href="#3">Menu Item 3</a></li>
<li><a href="#4">Menu Item 4</a></li>
</ul>
</nav>
CSS
@import url(http://fonts.googleapis.com/css?family=Copse);
body {
background-color: #222;
font-family: 'Copse', arial, sans-serif;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
text-align: center;
}
li {
/*float: left;*/
display: inline-block;
width: 100px;
height: 30px;
border-bottom: 3px solid #dc143c;
margin: 0 1px;
position: relative;
}
a {
text-decoration: none;
color: #fff;
text-align: center;
display: block;
position: relative;
z-index: 1500;
line-height: 30px;
}
div.hhelper {
position: absolute;
z-index: 1400;
width:100px;
height: 3px;
background-color: #dc143c;
bottom: 0;
}
li.selected div.hhelper {
height: 30px;
}
JavaScript
$(function() {
$('#h li').append($('<div/>').addClass('hhelper'));
$('#h a').not('li.selected a').hover (function(){
$(this).parent().find('.hhelper')
.animate({height: 30}, 1000);
}, function(){
$(this).parent().find('.hhelper')
.animate({height: 3}, 1000);
});
});