真正的JavaScript伸展收缩型菜单_菜单导航特效

模板酷站
  •       3/5
  •       1
  •       2
  •       3
  •       4
  •       5
查看演示效果

      织梦DedeCMS视频教程买空间 租服务器 选网硕互联! 无忧站长工具,百度权重一键全查!

      真正的JavaScript伸展收缩型菜单鼠标放上看一看,是不是很酷?鼠标划出菜单项的时候,背景会伸长。菜单没有加链接,想用的自己加,再美化一下,尽对够个性吧。

      <html> <head> <title>真正的JavaScript伸展收缩型菜单</title> <style type="text/css"> #con div{width:100px;margin:5px 0 5px 0;font-size:9pt;height:23px;color:white;} </style> <div id="con"> <div style="background-color:red">红色菜单</div> <div style="background-color:green">绿色菜单 </div> <div style="background-color:blue">蓝色</div> <div style="background-color:yellow">黄色</div> <div style="background-color:pink">这是什么色</div> <div style="background-color:orange">桔色</div> <div style="background-color:black">玄色超酷</div> </div> <script language="javascript"> function $(e){return document.getElementById(e);} // www.mb5u.com function roulMenu(e,maxW,minW){ var divs = $(e).getElementsByTagName('div'); for(var i=0;i<divs.length;i++){ (function(){ var tims,timss; divs[i].onmouseover=function(){ var self = this; clearInterval(timss); tims=setInterval(function(){ if(self.offsetWidth<maxW){ self.style.width = self.offsetWidth + 5 + 'px'; }else{ clearInterval(tims); } },10); } divs[i].onmouseout=function(){ var self = this; clearInterval(tims); timss=setInterval(function(){ if(self.offsetWidth>minW){ self.style.width = self.offsetWidth - 5 + 'px'; }else{ clearInterval(timss); } },10); } })(); } } //使用方法 roulMenu('con',200,100); </script>