Return to Snippet

Revision: 34096
at October 17, 2010 09:01 by e11world


Initial Code
<h3>Menu</h3>
<ul>
	<li><a onclick="return true;" href="#menu1">Menu1</a></li>
	<li><a onclick="return true;" href="#menu2">Menu2</a></li>
	<li><a onclick="return true;" href="#menu3">Menu3</a></li>
</ul>

/*********************************************** FLOATING MENU *****/

#floatMenu {
	position:absolute;
	top:30%;
	left:10px;
	width:200px;
	background-color:#fff;
	margin:0;
	padding:0;
	font-size:11px;
	border-left:1px solid #ddd;
	border-right:1px solid #ddd;
}
 
#floatMenu h3 {
	color:#fff;
	padding:3px;
	margin:0;
	background-color:#0E130F;
	border-bottom:1px solid #ddd;
	border-top:1px solid #ddd;
	font-size:13px;
	text-align:center;
}
 
#floatMenu ul {
	margin:0;
	padding:0;
	list-style:none;
}
 
#floatMenu ul li {
	padding-left:10px;
	background-color:#f5f5f5;
	border-bottom:1px solid #ddd;
	border-top:1px solid #ddd;
}
 
#floatMenu ul li a {
	text-decoration:none;
	font-weight: normal;
} 
#floatMenu ul li a:hover {
	color: #000;
	padding-left: 1px;
}



/* floating menu */
$(function(){
	function moveFloatMenu() {
		var menuOffset = menuYloc.top + $(this).scrollTop() + "px";
		$('#floatMenu').animate({top:menuOffset},{duration:500,queue:false});
	}
 
	menuYloc = $('#floatMenu').offset();
 
	$(window).scroll(moveFloatMenu);
 
	moveFloatMenu();
});

Initial URL
http://net.tutsplus.com/tutorials/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/

Initial Description
This is a very useful piece of code (html, css, jquery) to have a nice animated floating menu on your page. I totally love it.
I used it with jquery 1.3.2 and up

Initial Title
Animated Floating MENU scrolling with page

Initial Tags
css, javascript, html, navigation, jquery

Initial Language
jQuery