为了账号安全,请及时绑定邮箱和手机立即绑定

我这个导航栏动画效果只能变大,不能变回去为什么啊???

我这个导航栏动画效果只能变大,不能变回去为什么啊???

lulubiu 2017-04-23 19:08:42
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>导航栏的制作</title> <style> *{margin:0 ;padding: 0; font-size: 15px} ul{ list-style: none; margin-right: 5px; margin-top: 50px;  } li{float:left;} a{ text-decoration: none; display: block; width: 70px; height: 20px; text-align: center; background-color: #ccc; border: 2px solid black; padding: 5px 2px; } .on,a:hover{background: yellow; color:green; height:30px; line-height: 30px; margin-top: -10px;} </style> <script> window.onload=function() { var aA=document.getElementsByTagName("a"); for(var i=0;i<aA.length;i++) { aA[i].onmouseover=function(){ clearInterval(this.time); var This=this ; This.time=setInterval(function(){ This.style.width=This.offsetWidth+8+"px"; if(This.offsetWidth>=100){ clearInterval(This.time) } },30) } aA[i].onmouseout=function(){ clearInterval(this.time); var This=this ; This.time=setInterval(function(){ This.style.width=This.offsetWidth-8+"px"; if(This.offsetWidth<=70){ This.style.width = "70px"; clearInterval(This.time) } },30) } } } </script> </head> <body> <ul> <li><a href="#">首页</a></li> </ul> <ul> <li><a href="#">新闻快讯</a></li> </ul> <ul> <li><a href="#">产品展示</a></li> </ul> <ul> <li><a href="#">意见反馈</a></li> </ul> <ul> <li><a href="#">联系我们</a></li> </ul> </body> </html>
查看完整描述

1 回答

已采纳
?
西兰花伟大炮

TA贡献376条经验 获得超318个赞


我测试可以变回去啊,就是这个代码

查看完整回答
1 反对 回复 2017-04-23
  • 1 回答
  • 0 关注
  • 1142 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信