欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS下拉緩沖菜單示例代碼

 更新時(shí)間:2013年08月30日 16:34:32   作者:  
下拉緩沖菜單效果想必大家都有見(jiàn)過(guò)吧,在本文使用JS輕松實(shí)現(xiàn)下,想學(xué)習(xí)的朋友可以參考下
復(fù)制代碼 代碼如下:

<!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>
<style>
body,html,div,ul,li,span,img,a{
margin:0;
padding:0;
}
a{
text-decoration:none;
color:#000;
font-weight:bold;
width:150px;
display:inline-block;
text-align:center;
}
li{
list-style:none;
}
img{
width:0;
height:0;
outline:none;
}
#tab{
margin:200px 0 0 300px;
}
#tab li{
float:left;
width:150px;
height:50px;
line-height:50px;
position:relative;
margin-right:30px;
}
#tab img.map,#tab span.content{
position:absolute;
}
#tab span.content{
background:#333;
color:#FFF;
font-size:14px;
text-align:center;
height:0;
}
#tab img.map{
left:50%;
bottom:0;
}
</style>
<title>JS下拉緩沖菜單_網(wǎng)頁(yè)代碼站()</title>
</head>

<body>
<div id="tab">
<ul>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">路飛</a>
<img src="/jscss/demoimg/201210/psb1.jpg" class="map" />
<span class="content">草帽海賊團(tuán)船長(zhǎng),特征是頭戴草帽,天性樂(lè)觀、熱情、善良、天真、單純。</span>
</li>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">索隆</a>
<img src="/images/20130826/psb2.jpg" class="map" />
<span class="content">草帽海賊團(tuán)劍士,綠色頭發(fā),左耳戴三只黃色露珠耳環(huán),綠色的肚兜,路癡。</span>
</li>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">娜美</a>
<img src="/jscss/demoimg/201210/psb3.jpg" class="map" />
<span class="content">精通氣象學(xué)和航海術(shù),擅長(zhǎng)偷術(shù)、騙術(shù)、談判及威脅恐嚇,頭腦聰明又機(jī)靈。</span>
</li>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">山治</a>
<img src="/images/20130826/psb4.jpg" class="map" />
<span class="content">草帽海賊團(tuán)廚師,金發(fā),有著卷曲眉毛,永遠(yuǎn)遮住半邊臉的家伙,海賊中的紳士。</span>
</li>
</ul>
</div>
<script type="text/javascript">
function kzxf_zoom(id)
{
this.initialize.apply(this, arguments)
}

kzxf_zoom.prototype =
{
initialize : function()

{

var _this = this;
this.wrapBox = document.getElementById('tab');
this.oLi = this.wrapBox.getElementsByTagName('li');
this.aImg = this.wrapBox.getElementsByTagName('img');
this.content = this.wrapBox.getElementsByTagName('span');
for(var i=0;i<this.oLi.length;i++)
{
(function(i){
_this.oLi[i].onmouseover = function()

{
_this.jump(_this.aImg[i], _this.content[i]);

};
_this.oLi[i].onmouseout = function()

{
_this.hidden(_this.aImg[i], _this.content[i]);

};

})(i)

}

},
jump : function(obj1, obj2)

{

var _this = this;
_this.animation(obj1, {height:130, width:160, marginLeft:-78, marginTop:-128},function(){
_this.animation(obj1, {height:115, width:140, marginLeft:-70, marginTop:-115}, function(){
_this.animation(obj1, {height:120, width:150, marginLeft:-75, marginTop:-120})
})
});
_this.animation(obj2, {height:200});
},
hidden : function(obj1, obj2)
{
var _this = this;
_this.animation(obj1, {width:0, height:0, marginLeft:0, marginTop:0});
_this.animation(obj2, {height:0});
},
animation : function(obj, oAttr, fnCallBack)
{
var _this = this;
clearInterval(obj.timer);
obj.timer = setInterval(function()
{
var bStop = true;
for(proper in oAttr)
{

var iCur = parseFloat(_this.css(obj, proper));

proper == 'opacity' && (iCur = parseInt(iCur.toFixed(2) * 100));

var iSpeed = (oAttr[proper] - iCur) / 5;

iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);

if(iCur != oAttr[proper])

{

bStop = false;

_this.css(obj, proper, iCur + iSpeed);

}

}

if(bStop)

{

clearInterval(obj.timer);

fnCallBack && fnCallBack.apply(_this, arguments);

}

},20);

},

css : function(obj, attr, value)

{

if(arguments.length == 2)

{

return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, null)[attr]

}

if(arguments.length == 3)

{

switch(attr)

{

case 'width' :

case 'height' :

case 'top' :

case 'bottom' :

case 'left' :

case 'marginLeft':

case 'marginTop':

obj.style[attr] = value + 'px';

break;

case 'opacity' :

obj.style.filter = 'alpha(opacity = '+value+' )';

obj.style.opacity = value / 100;

break;

default :

obj.style[attr] = value;

break;

}

}

}

};
window.onload = function()
{
new kzxf_zoom('tab')

};

</script>
<br />
http://user.qzone.qq.com/1198772766
</body>
</html>

相關(guān)文章

  • 使用 JavaScript 進(jìn)行函數(shù)式編程 (一) 翻譯

    使用 JavaScript 進(jìn)行函數(shù)式編程 (一) 翻譯

    本文是函數(shù)式編程系列的第一篇文章。這里我會(huì)簡(jiǎn)要介紹一下編程范式,然后會(huì)直接介紹使用 Javascript 進(jìn)行函數(shù)式編程的概念,因?yàn)?JavsScript 是最被認(rèn)可的函數(shù)式程序語(yǔ)言之一。我們鼓勵(lì)讀者通過(guò)參考資料部分進(jìn)一步了解這一迷人的概念
    2015-10-10
  • vite打包優(yōu)化vite-plugin-compression的使用示例詳解

    vite打包優(yōu)化vite-plugin-compression的使用示例詳解

    這篇文章主要介紹了vite打包優(yōu)化vite-plugin-compression的使用,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-09-09
  • javascript 24點(diǎn)游戲代碼

    javascript 24點(diǎn)游戲代碼

    非常不錯(cuò)的技術(shù)24點(diǎn)的游戲代碼,他的算法值得學(xué)習(xí),希望喜歡游戲的朋友,可以來(lái)看看
    2008-06-06
  • ListBox實(shí)現(xiàn)上移,下移,左移,右移的簡(jiǎn)單實(shí)例

    ListBox實(shí)現(xiàn)上移,下移,左移,右移的簡(jiǎn)單實(shí)例

    這篇文章主要介紹了ListBox實(shí)現(xiàn)上移,下移,左移,右移的簡(jiǎn)單實(shí)例。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2014-02-02
  • js刪除對(duì)象中的某一個(gè)字段的方法實(shí)現(xiàn)

    js刪除對(duì)象中的某一個(gè)字段的方法實(shí)現(xiàn)

    這篇文章主要介紹了js刪除對(duì)象中的某一個(gè)字段的方法實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • javascript實(shí)現(xiàn)數(shù)組扁平化六種技巧總結(jié)

    javascript實(shí)現(xiàn)數(shù)組扁平化六種技巧總結(jié)

    這篇文章主要為大家詳細(xì)介紹了六種javascript中實(shí)現(xiàn)數(shù)組扁平化的技巧,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,感興趣的小伙伴可以了解下
    2023-12-12
  • 實(shí)例詳解JavaScript靜態(tài)作用域和動(dòng)態(tài)作用域

    實(shí)例詳解JavaScript靜態(tài)作用域和動(dòng)態(tài)作用域

    作用域是指程序源代碼中定義變量的區(qū)域,作用域規(guī)定了如何查找變量,也就是確定當(dāng)前執(zhí)行代碼對(duì)變量的訪問(wèn)權(quán)限,這篇文章主要給大家介紹了關(guān)于JavaScript靜態(tài)作用域和動(dòng)態(tài)作用域的相關(guān)資料,需要的朋友可以參考下
    2021-10-10
  • javascript正則表達(dá)式使用replace()替換手機(jī)號(hào)的方法

    javascript正則表達(dá)式使用replace()替換手機(jī)號(hào)的方法

    這篇文章主要介紹了javascript正則表達(dá)式使用replace()替換手機(jī)號(hào)的方法,可實(shí)現(xiàn)把手機(jī)號(hào)第4位到第7位替換成****的功能,是非常實(shí)用的技巧,需要的朋友可以參考下
    2015-01-01
  • 如何在一個(gè)頁(yè)面顯示多個(gè)百度地圖

    如何在一個(gè)頁(yè)面顯示多個(gè)百度地圖

    經(jīng)常有人問(wèn),百度地圖JavaScript API能在同一頁(yè)面顯示多個(gè)地圖嗎?當(dāng)然可以啊,為什么不可以呢?地圖之于頁(yè)面無(wú)非就是個(gè)div,我們可以在頁(yè)面顯示多個(gè)div,自然也可以顯示多個(gè)地圖。
    2013-04-04
  • BootStrap中的模態(tài)框(modal,彈出層)功能示例代碼

    BootStrap中的模態(tài)框(modal,彈出層)功能示例代碼

    bootstrap中的模態(tài)框(modal),不同于Tooltips,模態(tài)框以彈出對(duì)話框的形式出現(xiàn),具有最小和最實(shí)用的功能集。這篇文章主要介紹了BootStrap中的模態(tài)框(modal,彈出層),需要的朋友可以參考下
    2018-11-11

最新評(píng)論