导航栏效果
来源:互联网 发布:多功能圣经软件下载 编辑:程序博客网 时间:2024/05/16 17:21
<!DOCTYPE html>
<html>
<head>
<metacharset="UTF-8">
<title>导航栏效果</title>
<styletype="text/css">
*{
margin:0;
padding:0;
}
#wrap{
width:500px;
height:30px;
padding-top:10px;
border:1pxsolid gold;
margin:100pxauto;
position:relative;
overflow:hidden;
}
li{
list-style:none;
width:100px;
height:50px;
float:left;
text-align: center;
}
a{
text-decoration:none;
}
#line{
width:100px;
height:3px;
background:red;
position:absolute;
top:30px;
left:0;
}
</style>
</head>
<body>
<div id="wrap">
<li><ahref="###">新闻</a></li>
<li><ahref="###">热点</a></li>
<li><ahref="###">娱乐</a></li>
<li><ahref="###">音乐</a></li>
<li><ahref="###">体育</a></li>
<!--滑动条-->
<div id="line"></div>
</div>
<scriptsrc="JS/tween.js" type="text/javascript"></script>
<scripttype="text/javascript">
//获取滑动条
varline = document.getElementById("line");
//获取所有的a标签
varaArray = document.getElementsByTagName("a");
//声明一个变量存储当前移入的标签的下标
varindex = 0;
//声明一个变量储存上一次移入的标签的下标
varprevious = 0;
//声明一个变量存储创建的定时器
vartimer;
//t
vart = 0;
//b
varb = 0;
//c
varend;
var c = end - b;
//d
vard = 10;
//为每一个a链接绑定一个鼠标移入事件
for(vari = 0; i < aArray.length; i++){
aArray[i].onmouseenter= (function(nowIndex){
returnfunction(){
//存储当前的位置
index= nowIndex;
b= previous * 100;
end= index * 100;
c= end - b;
functionmove(){
t++;
line.style.left= Tween.Linear(t, b, c, d) + "px";
if(t== d){
t= 0;
clearInterval(timer);
}
}
timer=setInterval(move, 20);
//移动过后当前的位置就变成上一次位置
previous= index;
}
})(i);
aArray[i].onmouseleave= function(){
clearInterval(timer);
// setTimeout(clear_timer, 300);
}
//延时器setTimeout()
// function clear_timer(){
// clearInterval(timer)
// }
}
</script>
</body>
</html>
- 导航栏效果应用
- 导航栏渐变效果
- 导航栏翻滚效果
- 导航栏效果
- 导航栏翻转效果
- 动画效果css导航栏
- jquery模拟导航栏效果
- 导航栏消失动画效果
- 导航栏设置阴影效果
- 导航栏的动态效果
- ios8 导航栏效果一览表
- IOS导航栏透明效果
- Android个性导航栏效果
- Android之导航栏效果
- 导航栏悬停效果制作
- 导航栏颜色渐变效果
- HTML侧面导航栏效果
- 导航效果
- Python3学习二之基本数据类型
- java 引用
- vector效率低怎么破?
- C++“准”标准库Boost学习指南(2):Boost.Conversion
- 【Primes on Interval】
- 导航栏效果
- WSASocket()与Socket()的区别
- I/O流之内存流
- 互联网广告系统综述五系统架构
- 顾问式销售的双赢理念
- 轮播图
- 杭电oj编码2009
- 京东版轮播图
- Linux下Mycat安装配置和使用