jQuery实现背景弹性滚动的导航效果_

上传人:桔**** 文档编号:458269196 上传时间:2022-07-25 格式:DOCX 页数:7 大小:13.03KB
返回 下载 相关 举报
jQuery实现背景弹性滚动的导航效果__第1页
第1页 / 共7页
jQuery实现背景弹性滚动的导航效果__第2页
第2页 / 共7页
jQuery实现背景弹性滚动的导航效果__第3页
第3页 / 共7页
jQuery实现背景弹性滚动的导航效果__第4页
第4页 / 共7页
jQuery实现背景弹性滚动的导航效果__第5页
第5页 / 共7页
点击查看更多>>
资源描述

《jQuery实现背景弹性滚动的导航效果_》由会员分享,可在线阅读,更多相关《jQuery实现背景弹性滚动的导航效果_(7页珍藏版)》请在金锄头文库上搜索。

1、jQuery实现背景弹性滚动的导航效果_ 这篇文章主要介绍了jQuery实现背景弹性滚动导航效果的方法,涉及jQuery动态操作页面元素样式的相关技巧,需要的伴侣可以参考下 本文实例讲解并描述了jQuery实现背景弹性滚动的导航效果。分享给大家供大家参考,具体如下: 代码如下: !DOCTYPE html PUBLIC -/W3C/DTD XHTML 1.0 Transitional/EN l1/DTD/xhtml1-transitional.dtd html xmlns=l head title背景弹性滚动的导航效果/title meta http-equiv=content-type co

2、ntent=text/html;charset=gb2312 / !-把下面代码加到head与/head之间- style type=text/css .nav-wrap margin: 0 auto; background-color: #121212; border-top: 1px solid #FFF; border-bottom: 1px solid #FFF; .group:after visibility: hidden; display: block; font-size: 0; content: ; clear: both; height: 0; *:first-child+

3、html .group /* IE7 */ zoom: 1; #example width: 960px; margin: 0 auto; list-style: none; position: relative; #example li display: inline; #example li a position: relative; z-index: 200; color: #AAA; font-size: 14px; display: block; float: left; padding: 12px 10px 10px 10px; text-decoration: none; tex

4、t-transform: uppercase; #example li a:hover color: #FFF; #example #magic-line-two width: 100px; position: absolute; top: 0; left: 0; background: #666; z-index: 100; -moz-border-radius: 5px; -webkit-border-radius: 5px; .current a color: #FFF !important; /style script type=text/javascript src=jquery.m

5、in.js/script script type=text/javascript $(function() var $el, leftPos, newWidth, $mainNav = $(#example); /* EXAMPLE */ $mainNav.append(li id=magic-line-two/li); var $magicLineTwo = $(#magic-line-two); $magicLineTwo .width($(.current).width() .height($mainNav.height() .css(left, $(.current a).positi

6、on().left) .data(origLeft, $(.current a).position().left) .data(origWidth, $magicLineTwo.width() .data(origColor, $(.current a).attr(rel); $(#example li).find(a).hover(function() $el = $(this); leftPos = $el.position().left; newWidth = $el.parent().width(); $magicLineTwo.stop().animate( left: leftPo

7、s, width: newWidth, backgroundColor: $el.attr(rel) ) , function() $magicLineTwo.stop().animate( left: $magicLineTwo.data(origLeft), width: $magicLineTwo.data(origWidth), backgroundColor: $magicLineTwo.data(origColor) ); ); ); /script /head body 预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了;当然,在实际用法中,不会消失这样的问题。

8、br !-把下面代码加到body与/body之间- div class=nav-wrap ul class=group id=example li class=currenta href=# _fcksavedurl=#Home/a/li lia href=# _fcksavedurl=#About me/a/li lia href=# _fcksavedurl=#Our Team/a/li lia href=# _fcksavedurl=#Portfolio/a/li lia href=# _fcksavedurl=#The Show/a/li lia href=# _fcksavedurl=#Videos/a/li lia href=# _fcksavedurl=#CSS/HTML/a/li lia href=# _fcksavedurl=#jQuery/a/li lia href=# _fcksavedurl=#Navigation/a/li lia href=# _fcksavedurl=#Wordpress/a/li lia href=# _fcksavedurl=#Contact/a/li /ul /div /body /html 盼望本文所述对大家jQuery程序设计有所关心。 .

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作计划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号