第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么我這個(gè)鏈?zhǔn)竭\(yùn)動(dòng)實(shí)現(xiàn)不了?

為什么我這個(gè)鏈?zhǔn)竭\(yùn)動(dòng)實(shí)現(xiàn)不了?

hj000000 2016-03-30 14:53:42
?<!DOCTYPE html><html><head> <title></title> <style type="text/css"> *{margin:0;padding:0} ul li{list-style:none;} ul li{width:200px;height:50px;margin: 20px 0; background:yellow; filter: alpha:(opacity:30);opacity: 0.3;} </style> <script type="text/javascript"> window.onload=function(){ var x=document.getElementsByTagName("li"); for (var i = 0; i < x.length; i++) { ? ? x[i].timer=null; x[i].onmouseover=function(){ startMove(this,"width",100,function(){ startMove(this,"height",500) }); } ? ?x[i].onmouseout=function(){ startMove(this,"height",50,function(){ startMove(this,"width",200); }); } } } function getStyle(obj,attr){ if (obj.currentStyle) {return obj.currentStyle[attr];} else{return getComputedStyle(obj,false)[attr];} } function startMove(obj,attr,zd,fn){ clearInterval(obj.timer); obj.timer=setInterval(function(){ var sxz=0; if (attr=="opacity")? ? ?{ var sxz=Math.round(parseFloat(getStyle(obj,attr))*100); ? ?} else{ ? ?var sxz=parseInt(getStyle(obj,attr)); ? ? ? ?} var speed=(zd-sxz)/10; speed=speed>0?Math.ceil(speed):Math.floor(speed); if (sxz==zd)? ? ?{ ? ?clearInterval(obj.timer);? ? ? if (fn) {fn()}; ? ? } else{ ? ? ? ?? if (attr=="opacity")? ? ?{ ? ? ?var alpha1=sxz+speed; ? ? ?obj.style.filter="opacity:( alpha:alpha1)"; ? ? ?obj.style.opacity=alpha1/100; ? ? ? ?} ? ?else ? ?{ ? ? ?obj.style[attr]=sxz+speed+"px"; ? ?} ? ? ? ?} },30) } </script></head><body><ul> <li></li> <li></li> <li></li></ul></body></html>
查看完整描述

2 回答

已采納
?
ruibin

TA貢獻(xiàn)358條經(jīng)驗(yàn) 獲得超213個(gè)贊

你的問題不是出在鏈?zhǔn)讲僮?,而是出在?8和23行。你這個(gè)this的指向問題,由于this在內(nèi)層函數(shù)里面,而內(nèi)層函數(shù)又是一個(gè)全局函數(shù),所以此時(shí)的this指向window。要讓程序正常運(yùn)行,只需要在18行修改下代碼代碼var self = this;
startMove(self,"width",100,function(){},在23行修改一下代碼var self = this;
startMove(self,"height",50,function(){}。調(diào)整this的指向,那就ok了

查看完整回答
1 反對(duì) 回復(fù) 2016-03-30
?
qq_J_13

TA貢獻(xiàn)7條經(jīng)驗(yàn) 獲得超0個(gè)贊

可能是瀏覽器不兼容、我在火狐ie8下試了下可以的

查看完整回答
反對(duì) 回復(fù) 2016-03-30
  • 2 回答
  • 0 關(guān)注
  • 1408 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)