h5+css 菜单导航---改变宽度
来源:互联网 发布:汽车行业的大数据应用 编辑:程序博客网 时间:2024/05/01 23:11
菜单导航—改变宽度
1、使用javascript脚本实现:
<!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>导航菜单</title><style type="text/css">* { margin: 0; padding: 0; font-size: 14px; }a { color: #333; text-decoration: none }ul { list-style: none; height: 30px; border-bottom: 5px solid #F60; margin-top: 20px; padding-left: 50px; }ul li { float: left }ul li a { display: block; height: 30px; text-align: center; line-height: 30px; width:120px; background: #efefef; margin-left: 1px; }a.on, a:hover { background: #F60; color: #fff; }</style><script>window.onload=function(){ var as = document.getElementsByTagName("a"); for(var i=0; i<as.length; i++) { as[i].onmouseover=function() { var this1 = this; clearInterval(si); var si = setInterval ( function() { this1.style.width = this1.offsetWidth+10+"px"; if(this1.offsetWidth>160) { clearInterval(si); } },30); } as[i].onmouseout = function() { var this2 = this; clearInterval(si); var si = setInterval ( function() { this2.style.width=this2.offsetWidth-10+"px"; if(this2.offsetWidth<120) { clearInterval(si); } },30); } }}</script></head><body><ul> <li><a class="on" href="#">首 页</a></li> <li><a href="#">新闻快讯</a></li> <li><a href="#">产品展示</a></li> <li><a href="#">售后服务</a></li> <li><a href="#">联系我们</a></li></ul></body></html>
效果图:
0 0
- h5+css 菜单导航---改变宽度
- h5+css 垂直导航菜单
- h5+css 伸缩菜单---改变高度
- css导航菜单
- div+CSS导航菜单
- CSS导航菜单
- CSS打造导航菜单
- 制作CSS导航菜单
- css导航菜单
- css 导航二级菜单
- CSS 导航菜单
- css 导航菜单
- h5+css 水平菜单制作
- h5+css 圆角菜单
- h5学习笔记(3) 导航菜单
- h5学习笔记: 导航菜单(2)
- 改变ComboBox下拉菜单的宽度
- 快速制作CSS导航菜单
- 可变参数
- 面向对象8
- ARM CORTEX-M3简介
- 165. Compare Version Numbers
- APP登陆协议的分析
- h5+css 菜单导航---改变宽度
- 不通过App Store装MAC系统
- 产生随机数可以提高网络安全的新方法(New method of producing random numbers could improve cybersecurity)
- 队列的实现
- 截屏事件监听实现
- 设计模式——4.装饰模式
- javascript字符操作大全
- Android开发环境部署 及 常见问题解决
- leetcode题解日练--2016.7.3