基本信息
源码名称:菜单效果
源码大小:3.26KB
文件格式:.html
开发语言:js
更新时间:2013-05-24
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

一款漂亮,实用的JS菜单效果

 

// JavaScript Document
 

function fx(el,attr,to){
  el=typeof el=='string'?document.getElementById(el):el;
  if(to>0)el.style.display='block';
  var w=el['offset' attr.replace(/^(.)/,new Function('return arguments[1].toUpperCase()'))];
  var Int=Math[to-w>0?'ceil':'floor'];
  clearInterval(el.timer);
  el.timer=setInterval(function(){
  w =Int((to-w)*0.1);
  el.style[attr]=w 'px';
  if(w==to){   
  if(to==0)el.style.display='none';
  clearInterval(el.timer);
  }; 
  },10);
 };
 window.onload = function (){
  var a=document.getElementById("t1");
  var b=document.getElementById("t2");
  var c=document.getElementById("t3");
     var d=document.getElementById("t4");
  var e=document.getElementById("t5");
  var d1=document.getElementById("div1");
  var d2=document.getElementById("div2");
  var d3=document.getElementById("div3");
  var d4=document.getElementById("div4");
  var d5=document.getElementById("div5");
  d1.onmouseover=a.onmouseover=function (){fx('div1','height',70)};
  d1.onmouseout=a.onmouseout=function (){fx('div1','height',0)};
  d2.onmouseover=b.onmouseover=function (){fx('div2','height',70)};
  d2.onmouseout=b.onmouseout=function (){fx('div2','height',0)};
  d3.onmouseover=c.onmouseover=function (){fx('div3','height',70)};
  d3.onmouseout=c.onmouseout=function (){fx('div3','height',0)};
     d4.onmouseover=d.onmouseover=function (){fx('div4','height',70)};
  d4.onmouseout=d.onmouseout=function (){fx('div4','height',0)};
  d5.onmouseover=e.onmouseover=function (){fx('div5','height',70)};
  d5.onmouseout=e.onmouseout=function (){fx('div5','height',0)}; 
  
 
 
}