您好,欢迎访问一九零五行业门户网

JQuery 写的个性导航菜单_jquery

(一):xhtml:
复制代码 代码如下:
home
services
faq
testimonials
about alpacas
contact us
(二):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;
}
(四) 效果图
其它类似信息

推荐信息