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

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

為什么進(jìn)入鏈?zhǔn)竭\(yùn)動(dòng)后沒有再執(zhí)行第二次調(diào)用的函數(shù)?求指點(diǎn)一下

為什么進(jìn)入鏈?zhǔn)竭\(yùn)動(dòng)后沒有再執(zhí)行第二次調(diào)用的函數(shù)?求指點(diǎn)一下

元芳怎么了 2023-04-23 16:17:36
編寫了一個(gè)函數(shù),用來做鏈?zhǔn)竭\(yùn)動(dòng)時(shí)改變屬性值,但是進(jìn)入鏈?zhǔn)竭\(yùn)動(dòng)后沒有再執(zhí)行第二次調(diào)用的函數(shù),請問為什么,附上源碼html:<html><head><meta charset="UTF-8"><title>旋轉(zhuǎn)圖標(biāo)</title><link rel="stylesheet" type="text/css" href="../css/RotateSport.css" /><script src="../js/RotateSport.js"></script></head><body><div id="box"><img src="../img/7.jpg" /></div></body></html>js:window.onload=function(){var oDiv=document.getElementById("box");var oImg=oDiv.getElementsByTagName("img")[0];oDiv.onmouseover=function(){startMove(oImg,{top:-170,opacity:30},function(){oImg.style.top=30+"px";startMove(oImg,{opacity:100,top:25});});}}function startMove(obj,json,fnEnd){var timer=null;var alpha=100;obj.timer=setInterval(function(){clearInterval(obj.timer);for(attr in json) {var key = true;//獲取當(dāng)前值var icur;if ("opacity" == attr) {icur = Math.round(parseFloat(getstyle(obj, attr)) * 100);}else {icur = parseInt(getstyle(obj, attr));}//改變速度var speed = (json[attr] - icur) /10;speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);//檢測當(dāng)前值if (json[attr] !== icur) {key = false;}if ("opacity" == attr) {obj.style.filter = "alpha(opacity:" + (speed + icur) + ")";obj.style.opacity = (speed + icur) / 100;}else {obj.style[attr] =(speed + icur)+ "px";}if(key){clearInterval(obj.timer);if(typeof fnEnd=="function"){fnEnd();}}}},30);}function getstyle(obj,attr){return getComputedStyle?getComputedStyle(obj,false)[attr]:obj.currentStyle[attr];}
查看完整描述

1 回答

?
白衣非少年

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

<!DOCTYPE HTML><html> <head>    <meta charset="UTF-8">    <title>旋轉(zhuǎn)圖標(biāo)</title><style>#box>img{top:30px;position:absolute;width:100px;height:100px;}</style>    <script>        window.onload = function() {            var oDiv = document.getElementById("box");            var oImg = oDiv.getElementsByTagName("img")[0];            oDiv.onmouseover = function() {                startMove(oImg, {                    top: -170,                    opacity: 30                }, function() {                    oImg.style.top = 30 + "px";                    startMove(oImg, {                        opacity: 100,                        top: 25                    });                });            }        }         function startMove(obj, json, fnEnd) { //在最上面清除即可。。。clearInterval(obj.timer);            var timer = null;            var alpha = 100;            obj.timer = setInterval(function() {                for (attr in json) {                    var key = true;                    //獲取當(dāng)前值                    var icur;                    if ("opacity" == attr) {                        icur = Math.round(parseFloat(getstyle(obj, attr)) * 100);                    } else {                        icur = parseInt(getstyle(obj, attr));                    }                    //改變速度                    var speed = (json[attr] - icur) / 10;                    speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);                    //檢測當(dāng)前值                    if (json[attr] !== icur) {                        key = false;                    }                    if ("opacity" == attr) {                        obj.style.filter = "alpha(opacity:" + (speed + icur) + ")";                        obj.style.opacity = (speed + icur) / 100;                    } else {                        obj.style[attr] = (speed + icur) + "px";                    }                    if (key) {                        clearInterval(obj.timer);                        if (typeof fnEnd == "function") {                            fnEnd();                        }                    }                }            }, 30);        }         function getstyle(obj, attr) {            return getComputedStyle ? getComputedStyle(obj, false)[attr] : obj.currentStyle[attr];        }    </script></head> <body>    <div id="box">        <img src="../img/7.jpg" />    </div></body> </html>


查看完整回答
反對(duì) 回復(fù) 2023-04-27
  • 1 回答
  • 0 關(guān)注
  • 105 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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