当前位置:编程学习 > JS >>

基于jQuery的滑动菜单

基于jQuery的滑动菜单,鼠标移到某菜单项上,菜单的背景可以滑动过来,平滑的滑动效果,炫动的导航效果,相比没有动画的菜单,这款菜单真的挺不错哦。
答案:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery实用炫动的导航效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
.nav{width:960px;text-align:center;background:#06F;margin:0 auto;position:relative;}
.nav a{width:104px;height:41px;line-height:41px;display:inline-block;margin-right:30px;position:relative;z-index:11111;color:#FFF;}
.nav_bj{background:#F00;width:104px;height:41px;position:absolute;top:0;z-index:111;left:210px;}
</style>
<script src="/ajaxjs/jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	var xxx,re;
	$(".nav a").mouseover(function(){
		xxx=$(this).position().left;
		$(".nav_bj").animate({left:xxx})
		clearTimeout(re);
		}).mouseout(function(){
			clearTimeout(re);
			re=setTimeout(function(){
				$(".nav_bj").animate({left:210})
			},500);
		})
	})
</script>
</head>
<body>
<div class="nav"><a href="#">首页</a><a href="#">站长资源库</a><a href="#">源码下载</a><a href="#">网页特效</a>
<div class="nav_bj"></div>
</div>
</body>
</html>

上一个:有立体感的多级菜单效果
下一个:自定义右键菜单

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,