*{ margin:0px; padding:0px; font-size:12px;}
ul li{ list-style:none;}
a{ text-decoration:none;}
#nav{ width:980px; margin:0 auto;}
#nav li{
height:36px; line-height:36px; background:#666666; text-align:center;
width:120px; position:relative; float:left; margin-right:10px;
}
#nav li a{ color:#FFFFFF; display:block; font-weight:bold;}
#nav ul{ height:0px; overflow:hidden; position:absolute; left:0px;}
#nav ul li{ background:#003366; height:28px; line-height:28px;}
#nav ul li a{ color:#FFFFFF; display:block; font-weight:normal;}
.clear{ zoom:1;}
.clear:after{ content:""; display:block; clear:both;}
window.onload=function()
{
var oNav=document.getElementById("nav");//獲取導(dǎo)航元素節(jié)點(diǎn)
var oLi=oNav.children;//獲取Nav下面的所有的li元素 返回的是一個集合
for(var i=0;i { //當(dāng)鼠標(biāo)移過去的時候 發(fā)生移動事件 oLi[i].onmouseover=function() { var oUl=this.getElementsByTagName("ul")[0];//獲取當(dāng)前l(fā)i下面的第一個節(jié)點(diǎn)
var oList=oUl.children;//獲取
var offsetHeight=oList[0].offsetHeight; //計算0下標(biāo) 也就是第一個元素的高度 28px
var iTargetHeight=(oList.length * offsetHeight) //相當(dāng)于li的個數(shù) * 每個 li的高度 height 5*28=????
//開始調(diào)用完美運(yùn)動框架....
startMove(oUl,{"height":iTargetHeight});
}
//當(dāng)鼠標(biāo)移開的時候 就關(guān)閉
oLi[i].onmouseout=function()
{
var oUl=this.getElementsByTagName("ul")[0];//獲取當(dāng)前l(fā)i下面的第一個
startMove(oUl,{"height":0});
}
}
}
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
asdfasdf
function startMove(obj, json, fn) {
clearInterval(obj.iTimer);
var iCur = 0;
var iSpeed = 0;
obj.iTimer = setInterval(function() {
var iBtn = true;
for ( var attr in json ) {
var iTarget = json[attr];
if (attr == 'opacity') {
iCur = Math.round(css( obj, 'opacity' ) * 100);
} else {
iCur = parseInt(css(obj, attr));
}
iSpeed = ( iTarget - iCur ) / 8;
iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
if (iCur != iTarget) {
iBtn = false;
if (attr == 'opacity') {
obj.style.opacity = (iCur + iSpeed) / 100;
obj.style.filter = 'alpha(opacity='+ (iCur + iSpeed) +')';
} else {
obj.style[attr] = iCur + iSpeed + 'px';
}
}
}
if (iBtn) {
clearInterval(obj.iTimer);
fn && fn.call(obj);
}
}, 20);
}
function css(obj, attr) {
if (obj.currentStyle) {
return obj.currentStyle[attr];
} else {
return getComputedStyle(obj, false)[attr];
}
}
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。