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

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

為什么距離瀏覽器邊框出來這么多?用的老師的move.js

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>無標(biāo)題文檔</title>

<style>

*{margin:0;padding:0;}

#div1{

width:200px;

height:200px;

background:#cd0000;

position:relative;

left:-200px;

top:0;

}

#div1 span{

color:#fff;

width:20px;

height:50px;

background:#cd0000;

position:absolute;

left:200px;

top:60px;

padding-top: 15px;

}

</style>

<script>

window.onload=function(){

var oDiv=document.getElementById('div1');

oDiv.onmouseover=function(){

startMove(oDiv,'left',0);

}

oDiv.onmouseout=function(){

startMove(oDiv,'left',-200);

}

}

function getStyle(obj,attr){

if(obj.currentStyle){

return obj.currentStyle[attr];

}

else{

return getComputedStyle(obj,false)[attr];

}

}// 獲取任意屬性至,針對IE與火狐做不同的處理 currentStyle是IE方法 Computed Style是火狐的方法

//==寫錯(cuò),很難發(fā)現(xiàn)錯(cuò)誤

function startMove(obj,attr,iTarget){

clearInterval(obj.timer);

obj.timer=setInterval(function(){

var icur=0;//取當(dāng)前值

if(attr=='opacity'){

icur=Math.round(parseFloat(getStyle(obj,attr))*100)

}

else{

icur=parseInt(getStyle(obj,attr));

}

//算速度

var speed=(iTarget-icur)/8

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

//檢測停止

if(icur==iTarget){

clearInterval(obj.timer);

}

else{

?if(attr=='opacity'){

obj.style.filter='alpha:(opacity:'+icur+speed+')';

obj.style.opacity=(icur+speed)/100;

? }

else{

obj.style[attr]=icur+speed+'px';

? }

? ? ? ? }

? ? },30)

}


</script>

</head>

<body>

<div id="div1">

<span class="share">分享</span>

</div>

</body>

</html>

http://img1.sycdn.imooc.com//567173f300013c6601640395.jpg

正在回答

1 回答

復(fù)制看了下,火狐,IE8,谷歌 除了"分享"亂碼了,其他完美運(yùn)行

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
JS動(dòng)畫效果
  • 參與學(xué)習(xí)       113920    人
  • 解答問題       1487    個(gè)

通過本課程JS動(dòng)畫的學(xué)習(xí),從簡單動(dòng)畫開始,逐步深入各種動(dòng)畫框架封裝

進(jìn)入課程

為什么距離瀏覽器邊框出來這么多?用的老師的move.js

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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