jquery動(dòng)感漂浮導(dǎo)航菜單代碼分享
這是一款基于jquery實(shí)現(xiàn)動(dòng)感漂浮導(dǎo)航菜單的特效代碼,菜單可以上下浮動(dòng),動(dòng)感十足,為自己的網(wǎng)站增加了活力,是一款非常實(shí)用的導(dǎo)航菜單特效源碼。
運(yùn)行效果圖:

點(diǎn)擊:下載源碼
為大家分享的jquery動(dòng)感漂浮導(dǎo)航菜單代碼如下
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery Floating Menu</title>
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script>
$(document).ready(function () {
//get the default top value
var top_val = $('#menu li a').css('top');
//animate the selected menu item
$('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
$('#menu li').hover(
function () {
//animate the menu item with 0 top value
$(this).children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
},
function () {
//set the position to default
$(this).children('a').stop().animate({top:top_val}, {easing: 'easeOutQuad', duration:500});
//always keep the previously selected item in fixed position
$('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
}
);
});
</script>
<style>
#menu {
list-style:none;
padding:0;
margin:0 auto;;
height:70px;
width:600px;
}
#menu li {
float:left;
width:109px;
height:inherit;
position:relative;
overflow:hidden;
}
#menu li a {
position:absolute;
top:20px;
text-indent:-999em;
background:url(menu.png) no-repeat 0 0;
display:block;
width:109px;
height:inherit;
/* fast png fix for ie6 */
position:relative;
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));
}
</style>
</head>
<body>
<br/><br/><br/>
<ul id="menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Item 4</a></li>
<li><a href="#">Item 5</a></li>
</ul>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery Floating Menu</title>
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script>
$(document).ready(function () {
//get the default top value
var top_val = $('#menu li a').css('top');
//animate the selected menu item
$('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
$('#menu li').hover(
function () {
//animate the menu item with 0 top value
$(this).children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
},
function () {
//set the position to default
$(this).children('a').stop().animate({top:top_val}, {easing: 'easeOutQuad', duration:500});
//always keep the previously selected item in fixed position
$('#menu li.selected').children('a').stop().animate({top:0}, {easing: 'easeOutQuad', duration:500});
}
);
});
</script>
<style>
#menu {
list-style:none;
padding:0;
margin:0 auto;;
height:70px;
width:600px;
}
#menu li {
float:left;
width:109px;
height:inherit;
position:relative;
overflow:hidden;
}
#menu li a {
position:absolute;
top:20px;
text-indent:-999em;
background:url(menu.png) no-repeat 0 0;
display:block;
width:109px;
height:inherit;
/* fast png fix for ie6 */
position:relative;
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));
}
</style>
</head>
<body>
<br/><br/><br/>
<ul id="menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Item 4</a></li>
<li><a href="#">Item 5</a></li>
</ul>
如果大家還想深入學(xué)習(xí),可以點(diǎn)擊jQuery級(jí)聯(lián)菜單特效匯總、Javascript級(jí)聯(lián)菜單特效匯總進(jìn)行學(xué)習(xí)。
以上就是為大家分享的jquery動(dòng)感漂浮導(dǎo)航菜單代碼,希望大家可以喜歡。
- jQuery實(shí)現(xiàn)精美的多級(jí)下拉菜單特效
- jQuery樹形下拉菜單特效代碼分享
- jQuery垂直多級(jí)導(dǎo)航菜單代碼分享
- jquery帶下拉菜單和焦點(diǎn)圖代碼分享
- jQuery實(shí)現(xiàn)的多級(jí)下拉菜單效果代碼
- jquery實(shí)現(xiàn)鼠標(biāo)滑過顯示二級(jí)下拉菜單效果
- jquery實(shí)現(xiàn)漂亮的二級(jí)下拉菜單代碼
- jquery實(shí)現(xiàn)平滑的二級(jí)下拉菜單效果
- jQuery實(shí)現(xiàn)多級(jí)下拉菜單jDropMenu的方法
- jquery專業(yè)的導(dǎo)航菜單特效代碼分享
相關(guān)文章
JQuery Mobile 彈出式登錄框的實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄狫Query Mobile 彈出式登錄框的實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05
jquery基礎(chǔ)知識(shí)第一講之認(rèn)識(shí)jquery
jquery基礎(chǔ)知識(shí)第一講之初次見面,對(duì)jquery有一個(gè)初步認(rèn)識(shí),為之后的學(xué)習(xí)打下基礎(chǔ),感興趣的小伙伴們可以參考一下2016-03-03
jQuery Ajax 仿AjaxPro.Utility.RegisterTypeForAjax輔助方法
我們都知道在AjaxPro的方法AjaxPro.Utility.RegisterTypeForAjax(typeof(所在類的類名));會(huì)將標(biāo)記有[Ajax.AjaxMethod]方法注冊(cè)在客戶端。2011-09-09
使用jquery+iframe做一個(gè)ajax上傳效果(實(shí)例)
下面小編就為大家?guī)硪黄褂胘query+iframe做一個(gè)ajax上傳效果(實(shí)例)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-08-08
jquery實(shí)現(xiàn)ajax提交form表單的方法總結(jié)
本篇文章主要是對(duì)jquery實(shí)現(xiàn)ajax提交form表單的方法進(jìn)行了總結(jié)介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2014-03-03

