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

JS下拉緩沖菜單示例代碼

 更新時間:2013年08月30日 16:34:32   作者:  
下拉緩沖菜單效果想必大家都有見過吧,在本文使用JS輕松實現(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)頁代碼站()</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">草帽海賊團船長,特征是頭戴草帽,天性樂觀、熱情、善良、天真、單純。</span>
</li>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">索隆</a>
<img src="/images/20130826/psb2.jpg" class="map" />
<span class="content">草帽海賊團劍士,綠色頭發(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ù),擅長偷術(shù)、騙術(shù)、談判及威脅恐嚇,頭腦聰明又機靈。</span>
</li>
<li style="background:url('/images/20130826/psb1.png')">
<a href="#">山治</a>
<img src="/images/20130826/psb4.jpg" class="map" />
<span class="content">草帽海賊團廚師,金發(fā),有著卷曲眉毛,永遠遮住半邊臉的家伙,海賊中的紳士。</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 進行函數(shù)式編程 (一) 翻譯

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

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

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

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

    javascript 24點游戲代碼

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

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

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

    js刪除對象中的某一個字段的方法實現(xiàn)

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

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

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

    實例詳解JavaScript靜態(tài)作用域和動態(tài)作用域

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

    javascript正則表達式使用replace()替換手機號的方法

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

    如何在一個頁面顯示多個百度地圖

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

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

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

最新評論