Skip to content

Instantly share code, notes, and snippets.

@gcyrillus
Created May 23, 2013 19:21
Show Gist options
  • Save gcyrillus/5638713 to your computer and use it in GitHub Desktop.
Save gcyrillus/5638713 to your computer and use it in GitHub Desktop.
useless !
/* useless ! */#nav {
position:relative;
margin:40px;
background-image:linear-gradient(0deg, white, gray);
-background-position: 0px 600px;
padding:0;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:21px;
font-weight:bold;
border-radius:5px;
box-shadow:2px 2px 3px #ccc;
}
#nav .clear{
clear:both;visibility:hidden;margin:-0.25em 0 ;
}
#nav ul{
padding:0 0 0 5px;
margin:0;
list-style:none;
text-align:center;
}
#nav li{
display:inline-block;
margin:5px 10px 5px 0;
}
#nav li a{
text-decoration:none;
color:black;
display:block;
padding:10px 15px;
}
<script src="jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<!-- rounded corners for IE -->
<script src="DD_roundies_0.0.2a-min.js"></script>
<script>
DD_roundies.addRule("#nav", "5px");
DD_roundies.addRule("#nav li", "5px");
</script>
<script>
$(document).ready(function(){
$nav_li=$("#nav li");
$nav_li_selected=$("#nav li.selected");
$nav_li_a=$nav_li.children("a");
var animSpeed=450; //fade speed
var hoverTextColor="white"; //text color on mouse over
var hoverBackgroundColor="black"; //background color on mouse over
var textColor=$nav_li_a.css("color");
var backgroundColor=$nav_li.css("background-color");
//init selected
$nav_li_selected.css("background-color",hoverBackgroundColor).children().css("color",hoverTextColor);
$nav_li_a.hover(function() {
var $this=$(this);
$this.stop().animate({ color: hoverTextColor }, animSpeed).parent().stop().animate({ backgroundColor: hoverBackgroundColor }, animSpeed);
},function() {
var $this=$(this);
if(!$this.parent().is(".selected")){
$this.stop().animate({ color: textColor }, animSpeed).parent().stop().animate({ backgroundColor: backgroundColor }, animSpeed);
}
});
//selected state
$nav_li_a.click(function(){
var $this=$(this);
$this.stop().animate({ color: hoverTextColor }, animSpeed).parent().stop().animate({ backgroundColor: hoverBackgroundColor }, animSpeed).addClass("selected").siblings(".selected").removeClass("selected").stop().animate({ backgroundColor: backgroundColor }, animSpeed).children().stop().animate({ color: textColor }, animSpeed);
});
});
</script>
<nav id="nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Contact Us</a></li>
</ul><hr class="clear"/>
</nav>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment