<div class="codetitle"> <span><a style="CURSOR: pointer" data="70115" class="copybut" id="copybut70115" onclick="doCopy('code70115')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code70115"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><head> <br><style> <br>body,html,div,ul,li,span,img,a{ <br>margin:0; <br>padding:0; <br>} <br>a{ <br>text-decoration:none; <br>color:#000; <br>font-weight:bold; <br>width:150px; <br>display:inline-block; <br>text-align:center; <br>} <br>li{ <br>list-style:none; <br>} <br>img{ <br>width:0; <br>height:0; <br>outline:none; <br>} <br>#tab{ <br>margin:200px 0 0 300px; <br>} <br>#tab li{ <br>float:left; <br>width:150px; <br>height:50px; <br>line-height:50px; <br>position:relative; <br>margin-right:30px; <br>} <br>#tab img.map,#tab span.content{ <br>position:absolute; <br>} <br>#tab span.content{ <br>background:#333; <br>color:#FFF; <br>font-size:14px; <br>text-align:center; <br>height:0; <br>} <br>#tab img.map{ <br>left:50%; <br>bottom:0; <br>} <br></style> <br><title>JS下拉缓冲菜单_网页代码站()</title> <br></head> <br><br><body> <br><div id="tab"> <br><ul> <br><li style="background:url('/images/20130826/psb1.png')"> <br><a href="#">路飞</a> <br><img src="/jscss/demoimg/201210/psb1.jpg" class="map" /> <br><span class="content">草帽海贼团船长,特征是头戴草帽,天性乐观、热情、善良、天真、单纯。</span> <br></li> <br><li style="background:url('/images/20130826/psb1.png')"> <br><a href="#">索隆</a> <br><img src="/images/20130826/psb2.jpg" class="map" /> <br><span class="content">草帽海贼团剑士,绿色头发,左耳戴三只黄色露珠耳环,绿色的肚兜,路痴。</span> <br></li> <br><li style="background:url('/images/20130826/psb1.png')"> <br><a href="#">娜美</a> <br><img src="/jscss/demoimg/201210/psb3.jpg" class="map" /> <br><span class="content">精通气象学和航海术,擅长偷术、骗术、谈判及威胁恐吓,头脑聪明又机灵。</span> <br></li> <br><li style="background:url('/images/20130826/psb1.png')"> <br><a href="#">山治</a> <br><img src="/images/20130826/psb4.jpg" class="map" /> <br><span class="content">草帽海贼团厨师,金发,有着卷曲眉毛,永远遮住半边脸的家伙,海贼中的绅士。</span> <br></li> <br></ul> <br></div> <br><script type="text/javascript"> <br>function kzxf_zoom(id) <br>{ <br>this.initialize.apply(this, argument) <br>} <br><br>kzxf_zoom.prototype = <br>{ <br>initialize : function( ) <br><br>{ <br><br>var _this = this; <br>this.wrapBox = document.getElementById('tab'); <br>this.oLi = this.wrapBox.getElementsByTagName('li'); <br>this.aImg = this.wrapBox.getElementsByTagName('img'); <br>this.content = this.wrapBox.getElementsByTagName('span'); <br>for(var i=0;i<this.oli.length>{ <br>(function(i){ <br>_this.oLi[i].onmouseover = function() <br><br>{ <br>_this.jump(_this.aImg[i], _this.content[i]); <br><br>}; <br>_this.oLi[i].onmouseout = function() <br><br>{ <br>_this.hidden(_this.aImg[i], _this.content[i]) <br><br>})(i) <br><br>} <br><br>}, <br>jump : function(obj1, obj2) <br><br>{ <br><br>var _this = this; <br>_this.animation(obj1, {高さ:130, 幅:160, marginLeft:-78, marginTop:-128},function(){ <br>_this.animation(obj1, {高さ:115, 幅:140 , marginLeft:-70, marginTop:-115}, function(){ <br>_this.animation(obj1, {高さ:120, 幅:150, marginLeft:-75, marginTop:-120}) <br>}) <br>}); <br>_this.animation(obj2, {高さ:200}); <br>}, <br>hidden : function(obj1, obj2) <br>{ <br>var _this = this; <br>_this.animation(obj1, {幅:0, 高さ:0, marginLeft:0, marginTop:0}); <br>_this.animation(obj2, {height:0}); <br>}, <br>アニメーション : function(obj, oAttr, fnCallBack) <br>{ <br>var _this = this; <br>clearInterval(obj.timer); <br>obj.timer = setInterval(function() <br>{ <br>var bStop = true; <br>for(oAttr で適切) <br>{ <br><br>var iCur = parseFloat(_this. css(obj, proper)); <br><br>proper == 'opacity' && (iCur = parseInt(iCur.toFixed(2) * 100)); <br><br>var iSpeed = (oAttr[proper] ] - iCur) / 5; <br><br>iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); <br><br>{ <br><br>bStop = false; <br><br>_this.css(obj, proper, iCur iSpeed) <br><br>} <br><br>if(bStop) <br><br>{ <br><br>clearInterval(obj.timer); <br><br>fnCallBack && fnCallBack.apply(_this, argument); 🎜>} <br><br>},20); <br><br>}, <br><br>css : function(obj, attr, value) <br><br>{ <br><br>if(arguments.length == 2) <br><br>{ <br><br>obj.currentStyle を返す ? obj.currentStyle[attr] : getComputedStyle(obj, null)[attr] <br><br>} <br><br>if(arguments.length == 3) <br><br>{ <br><br>switch(attr) <br><br>{ <br><br>ケース '幅' : <br><br>ケース '高さ' : <br><br>ケース '上' : <br><br>case 'bottom' : <br><br>case 'left' : <br><br>case 'marginLeft': <br><br>case 'marginTop': <br><br>obj.style[attr ] = 値 'px'; <br><br>休憩; <br><br>case 'opacity' : <br><br>obj.style.filter = 'alpha(opacity = ' value ' )'; <br><br>obj.style.opacity = 値 / 100; <br><br>休憩; <br><br>デフォルト: <br><br>obj.style[attr] = 値; <br><br>休憩; <br><br>} <br><br>} <br><br>} <br><br>}; <br>window.onload = function() <br>{ <br>new kzxf_zoom('tab') <br><br>}; <br><br></script> <br><br> <br>http://user.qzone.qq.com/1198772766 <br></body> <br></html> <br><br></this.oli.length> </div>