JQuery 写的个性导航菜单

来源:爱站网时间:2020-04-27编辑:网友分享
菜单导航功能在网页开发中起到引到客户的作用,它能帮我们准确的找到确切的位置,众所周知jQuery在开发中是非常优秀的,下面是爱站技术频道小编带给大家的JQuery 写的个性导航菜单,感兴趣的朋友一起来看看吧。

菜单导航功能在网页开发中起到引到客户的作用,它能帮我们准确的找到确切的位置,众所周知jQuery在开发中是非常优秀的,下面是爱站技术频道小编带给大家的JQuery 写的个性导航菜单,感兴趣的朋友一起来看看吧。

(一):XHTML:

 

 

 


(二):JQuery

 

 

 


$(document).ready(function(){
$('#navigationMenu li .normalMenu').each(function(){
// create a duplicate hyperlink and position it above the current one
$(this).before($(this).clone().removeClass().addClass('hoverMenu'));
});
$('#navigationMenu li').hover(function(){
// we assign an action on mouse over
$(this).find('.hoverMenu').stop().animate({marginTop:'0px'},200);
// the animate method provides countless possibilities
},
function(){
// and an action on mouse out
$(this).find('.hoverMenu').stop().animate({marginTop:'-25px'},200);
});
});


(三)CSS

 

 

 


/* Page styles */
body,h1,h2,h3,p,td,quote,small,form,input,ul,li,ol,label{
margin:0px;
padding:0px;
}
body{
margin-top:20px;
font-family:Arial, Helvetica, sans-serif;
color:#51555C;
height:100%;
font-size:12px;
}
/* Navigation menu styles */
ul{
height:25px;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
ul li{
border:1px solid #444444;
display:inline-block;
float:left;
height:25px;
list-style-type:none;
overflow:hidden;
}
ul li a, ul li a:hover,
ul li a:visited{
text-decoration:none;
}
.normalMenu, .normalMenu:visited,
.hoverMenu, .hoverMenu:visited,
.selectedMenu,.selectedMenu:visited {
outline:none;
padding:5px 10px;
display:block;
}
.hoverMenu,.hoverMenu:visited,
.selectedMenu,.selectedMenu:visited {
margin-top:-25px;
background:url(img/grey_bg.gif) repeat-x #eeeeee;
color:#444444;
}
.selectedMenu,.selectedMenu:visited {
margin:0;
}
.normalMenu, .normalMenu:visited{
color:white;
background:url(img/dark_bg.gif) repeat-x #444444;
}


(四) 效果图
 

以上就是爱站技术频道给大家介绍的JQuery 写的个性导航菜单,看完都知道了吧,JQuery是程序开发必备的,你不妨可以去试试哦,相信一定会让你实现你自己的风格。

上一篇:浅谈JS之iframe中的窗口

下一篇:JavaScript中出现乱码的处理心得

您可能感兴趣的文章

相关阅读

热门软件源码

最新软件源码下载