相思资源网 Design By www.200059.com
借助 插件 Lavalamp实现导航条动态显示效果, 以前用animate来实现,效果不是很好
复制代码 代码如下:
<script src="/UploadFiles/2021-04-02/jquery-2.0.0.min.js"><script src="js/jquery.easing.min.js"><script src="/UploadFiles/2021-04-02/jquery.lavalamp.js"><script type="text/javascript">
$(function() {
$(".nav").lavaLamp({
fx: "backout",
speed: 1100,
mouseover:function(event, menuItem){alert();}
});
});
</script>
<style>
.nav {
width:650px;
height:100px;
float:left;
position: relative;
}
.nav li {
width:auto;
min-width:40px;
line-height:100px;
padding:0 15px;
margin:0 10px 0 0;
color:#000;
font-size:14px;
text-align:center;
float:left;
}
.nav li.back {
background: #86bf40;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
line-height: 2;
width: 40px;
height: 100px; /*----*/
z-index: 1; /*----*/
position: absolute; /*----*/
margin-top: 0px;
margin-left:5px;
}
.nav li a {
color: #000;
z-index: 2; /*----*/
font-variant: small-caps;
text-decoration: none;
position: relative; /*----*/
margin: auto 10px;
}
</style>
</head>
<body>
<!-- header -->
<div class="headerbox">
<div class="header"> <a href="http://www.uuspeed.com/" class="logo"><img src="/UploadFiles/2021-04-02/logo.png"><ul class="nav">
<li class="current"><a href="#">首 页</a></li>
<li class="1"><a href="#">个人版</a></li>
<li class="2"><a href="#">中小版</a></li>
<li class="3"><a href="#">企业版</a></li>
<li class="4"><a href="#">服务与价格</a></li>
<li class="5"><a href="#">关于我们</a></li>
</a>
</ul>
<div class="login"> <a href="" class="icon_login">登 录</a> <a href="" class="icon_login">注 册</a> </div>
</div>
</div>
</body>
</html>
//// ------lavalamp.js文件修改--------------
复制代码 代码如下:
(function($) {
$.fn.lavaLamp = function(o) {
o = $.extend({ fx: "linear", speed: 500, click: function(){} }, o || {});
return this.each(function() {
var me = $(this),
noop = function(el){
},
$back = $('<li class="back"><div class="left"></div></li>').appendTo(me),
$li = $("li", this),
curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0];
$li.not(".back").hover(function() { move(this);});
$(".nav li:eq(0) a").css("color","#FFF");
function setCurr(el) {alert(el.offsetWidth);
$back.css({ "left": el.offsetLeft+"px", "width": el.offsetWidth+"px" });
curr = el;
};
function move(el) {
$back.each(function() {
$.dequeue(this, "fx"); }
).animate({
width: el.offsetWidth-40,
left: el.offsetLeft
}, o.speed, o.fx,function(){
var a0=$(".nav li:eq(0) a");
var a1=$(".nav li:eq(1) a");
var a2=$(".nav li:eq(2) a");
var a3=$(".nav li:eq(3) a");
var a4=$(".nav li:eq(4) a");
var a5=$(".nav li:eq(5) a");
if(el.offsetLeft==0){
$(".nav li:eq(0) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==92){
$(".nav li:eq(1) a").css("color","#FFF");
a0.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==194){
$(".nav li:eq(2) a").css("color","#FFF");
a1.css("color","#000");
a0.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==296){
$(".nav li:eq(3) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a0.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==398){
$(".nav li:eq(4) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a0.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==528){
$(".nav li:eq(5) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a0.css("color","#000");
}
});
};
});
};
})(jQuery);
效果见http://www.uuspeed.com/
复制代码 代码如下:
<script src="/UploadFiles/2021-04-02/jquery-2.0.0.min.js"><script src="js/jquery.easing.min.js"><script src="/UploadFiles/2021-04-02/jquery.lavalamp.js"><script type="text/javascript">
$(function() {
$(".nav").lavaLamp({
fx: "backout",
speed: 1100,
mouseover:function(event, menuItem){alert();}
});
});
</script>
<style>
.nav {
width:650px;
height:100px;
float:left;
position: relative;
}
.nav li {
width:auto;
min-width:40px;
line-height:100px;
padding:0 15px;
margin:0 10px 0 0;
color:#000;
font-size:14px;
text-align:center;
float:left;
}
.nav li.back {
background: #86bf40;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
line-height: 2;
width: 40px;
height: 100px; /*----*/
z-index: 1; /*----*/
position: absolute; /*----*/
margin-top: 0px;
margin-left:5px;
}
.nav li a {
color: #000;
z-index: 2; /*----*/
font-variant: small-caps;
text-decoration: none;
position: relative; /*----*/
margin: auto 10px;
}
</style>
</head>
<body>
<!-- header -->
<div class="headerbox">
<div class="header"> <a href="http://www.uuspeed.com/" class="logo"><img src="/UploadFiles/2021-04-02/logo.png"><ul class="nav">
<li class="current"><a href="#">首 页</a></li>
<li class="1"><a href="#">个人版</a></li>
<li class="2"><a href="#">中小版</a></li>
<li class="3"><a href="#">企业版</a></li>
<li class="4"><a href="#">服务与价格</a></li>
<li class="5"><a href="#">关于我们</a></li>
</a>
</ul>
<div class="login"> <a href="" class="icon_login">登 录</a> <a href="" class="icon_login">注 册</a> </div>
</div>
</div>
</body>
</html>
//// ------lavalamp.js文件修改--------------
复制代码 代码如下:
(function($) {
$.fn.lavaLamp = function(o) {
o = $.extend({ fx: "linear", speed: 500, click: function(){} }, o || {});
return this.each(function() {
var me = $(this),
noop = function(el){
},
$back = $('<li class="back"><div class="left"></div></li>').appendTo(me),
$li = $("li", this),
curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0];
$li.not(".back").hover(function() { move(this);});
$(".nav li:eq(0) a").css("color","#FFF");
function setCurr(el) {alert(el.offsetWidth);
$back.css({ "left": el.offsetLeft+"px", "width": el.offsetWidth+"px" });
curr = el;
};
function move(el) {
$back.each(function() {
$.dequeue(this, "fx"); }
).animate({
width: el.offsetWidth-40,
left: el.offsetLeft
}, o.speed, o.fx,function(){
var a0=$(".nav li:eq(0) a");
var a1=$(".nav li:eq(1) a");
var a2=$(".nav li:eq(2) a");
var a3=$(".nav li:eq(3) a");
var a4=$(".nav li:eq(4) a");
var a5=$(".nav li:eq(5) a");
if(el.offsetLeft==0){
$(".nav li:eq(0) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==92){
$(".nav li:eq(1) a").css("color","#FFF");
a0.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==194){
$(".nav li:eq(2) a").css("color","#FFF");
a1.css("color","#000");
a0.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==296){
$(".nav li:eq(3) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a0.css("color","#000");
a4.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==398){
$(".nav li:eq(4) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a0.css("color","#000");
a5.css("color","#000");
}
if(el.offsetLeft==528){
$(".nav li:eq(5) a").css("color","#FFF");
a1.css("color","#000");
a2.css("color","#000");
a3.css("color","#000");
a4.css("color","#000");
a0.css("color","#000");
}
});
};
});
};
})(jQuery);
效果见http://www.uuspeed.com/
标签:
jQuery,导航条,动态美化
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无jQuery 借助插件Lavalamp实现导航条动态美化效果的评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?