A5下载文章资讯

分类分类

jQuery实现带延迟效果的滑动菜单代码

2015-09-04 10:24作者:fang

本文实例讲述了jQuery实现带延迟效果的滑动菜单代码。分享给大家供大家参考。具体如下:

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="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="#">A5源码</a>

<a href="#">JS特效</a>

<a href="#">网页特效</a>

<div class="nav_bj"></div>

</div>

</body>

</html>

希望本文所述对大家的jquery程序设计有所帮助。

展开全部

相关

说两句网友评论
    我要跟贴
    取消