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

為了賬號安全,請及時綁定郵箱和手機立即綁定

JS動畫效果

vivian Web前端工程師
難度初級
時長 2小時 8分
學(xué)習(xí)人數(shù)
綜合評分9.60
537人評價 查看評價
9.8 內(nèi)容實用
9.6 簡潔易懂
9.4 邏輯清晰
  • 封閉式函數(shù):執(zhí)行類似淘寶跳上去又掉下來的效果 function getstyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; }else{ return getComputedStyle(obj,false)[attr]; } } var alpha=30; function move(obj,json,fn){ clearInterval(obj.timer); obj.timer=setInterval(function(){ var flag=true; for(var attr in json){ var curr=0; if(attr=="opacity"){ curr = Math.round(parseFloat(getstyle(obj,attr))*100); }else{ curr=parseInt(getstyle(obj,attr)); } //算速度 var speed=(json[attr]-curr)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); //檢測停止 if(curr!=json[attr]){ flag=false; } if(attr=="opacity"){ obj.style.filter="alpha(opacity:"+(curr+speed)+")"; obj.style.opacity=(curr+speed)/100; }else{ obj.style[attr]=curr+speed+"px"; } } if(flag){ clearInterval(obj.timer); if(fn){ fn(); } } },30) }
    查看全部
    0 采集 收起 來源:JS動畫案例

    2018-03-22

  • 向上跑再掉下來的頁面:
    查看全部
    0 采集 收起 來源:JS動畫案例

    2017-11-02

  • 類似淘寶向上跑再掉下來 div id="move"> <a href="#"><i><img src="img/badge-circle-direction-right.png"/></i><p>彩票</p></a> <a href="#"><i><img src="img/badge-square-check.png"/></i><p>電影</p></a> <a href="#"><i><img src="img/badge-square-direction-down.png"/></i><p>音樂</p></a> <a href="#"><i><img src="img/circle-glass.png"/></i><p>繳費</p></a> </div>
    查看全部
    0 采集 收起 來源:JS動畫案例

    2018-03-22

  • *{padding:0; margin:0;} #move { padding: 10px; width: 300px; background: #f4f4f4; border: 1px solid #ccc; margin: 10px auto; } #move a{display:inline-block; width:58px; height:25px; background:#fff; border:1px solid #f00; border-radius:3px; text-align:center; margin:10px 17px; position:relative; padding-top:40px; color:#c9c9c9; font-size:12px; text-decoration:none; line-height:25px; overflow:hidden;} #move a i{position:absolute; top:20px; left:0; display:inline-block; width:100%; text-align:center; opacity:1; filter:alpha(opacity=100); } #move a:hover{color:#f00;} #move img{border:none;} </style> <script src="move.js"></script>
    查看全部
    0 采集 收起 來源:JS動畫案例

    2018-03-22

  • 最后尾
    查看全部
  • 重點額
    查看全部
  • 重點:
    查看全部
  • 最終版 function getstyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; }else{ return getComputedStyle(obj,false)[attr]; } } var alpha=30; function move(obj,json,fn){ var flag=true;//假設(shè) clearInterval(obj.timer); obj.timer=setInterval(function(){ for(var attr in json){ //取當前值 var curr=0; if(attr=="opacity"){ curr = Math.round(parseFloat(getstyle(obj,attr))*100); }else{ curr=parseInt(getstyle(obj,attr)); } //算速度 var speed=(json[attr]-curr)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); //檢測停止 if(curr!=json[attr]){ flag=false; } if(attr=="opacity"){ obj.style.filter="alpha(opacity:"+(curr+speed)+")"; obj.style.opacity=(curr+speed)/100; }else{ obj.style[attr]=curr+speed+"px"; } } if(flag){ clearInterval(obj.timer); if(fn){ fn(); } } },30) }
    查看全部
  • 前段同步運動: <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> ul li{list-style:none;} li{width:200px; height:100px; background-color:yellow; margin-bottom:20px; border:2px solid #0f0; opacity:0.3; filter:alpha(opacity:30); } </style> <script src="test.js"></script> <script type="text/javascript"> window.onload=function(){ var ali=document.getElementById("li1"); ali.onmousemove=function(){ move(ali,{width:300,height:300}); } } //var json={a:1,b:2}; </script> </head> <body> <ul> <li id="li1"></li> </ul> </body>
    查看全部
  • function getstyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; }else{ return getComputedStyle(obj,false)[attr]; } } var alpha=30; function move(obj,json,fn){ clearInterval(obj.timer); obj.timer=setInterval(function(){ for(var attr in json){ var curr=0; if(attr=="opacity"){ curr = Math.round(parseFloat(getstyle(obj,attr))*100); }else{ curr=parseInt(getstyle(obj,attr)); } //算速度 var speed=(json[attr]-curr)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); //檢測停止 if(curr==json[attr]){ clearInterval(obj.timer); if(fn){ fn(); } }else{ if(attr=="opacity"){ obj.style.filter="alpha(opacity:"+(curr+speed)+")"; obj.style.opacity=(curr+speed)/100; }else{ obj.style[attr]=curr+speed+"px"; } } } },30) }
    查看全部
  • 上部分
    查看全部
  • 多物體運動,所有東西都不能公用
    查看全部
    0 采集 收起 來源:JS多物體動畫

    2017-11-01

  • 引入部分js var alpha=30; function move(obj,attr,target,fn){ clearInterval(obj.timer); obj.timer=setInterval(function(){ var curr=0; if(attr=="opacity"){ curr = Math.round(parseFloat(getstyle(obj,attr))*100); }else{ curr=parseInt(getstyle(obj,attr)); } //算速度 var speed=(target-curr)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); //檢測停止 if(curr==target){ clearInterval(obj.timer); if(fn){ fn(); } }else{ if(attr=="opacity"){ obj.style.filter="alpha(opacity:"+(curr+speed)+")"; obj.style.opacity=(curr+speed)/100; }else{ obj.style[attr]=curr+speed+"px"; } } },30) }
    查看全部
    0 采集 收起 來源:JS鏈式動畫

    2018-03-22

  • 綜合讓物體先寬后高在透明度 ul li{list-style:none;} li{width:200px; height:100px; background-color:yellow; margin-bottom:20px; border:2px solid #0f0; opacity:0.3; filter:alpha(opacity:30); } window.onload=function(){ var li=document.getElementById("li1"); li.onmouseover=function(){ move(li,"width",300,function(){ move(li,"height",300,function(){ move(li,"opacity",100); }) }); } } <ul> <li id="li1">1</li> </ul> unction getstyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; }else{ return getComputedStyle(obj,false)[attr]; } }
    查看全部
    0 采集 收起 來源:JS鏈式動畫

    2018-03-22

  • 邊寬-變高-透明度
    查看全部
    0 采集 收起 來源:JS鏈式動畫

    2017-11-01

舉報

0/150
提交
取消
課程須知
1.您至少已經(jīng)具備JavaSript的知識。2.您已經(jīng)具備一些開發(fā)經(jīng)驗。
老師告訴你能學(xué)到什么?
1.使用定時器實現(xiàn)簡單動畫。2.如何一步步封裝庫。2.培養(yǎng)編程的思想。

微信掃碼,參與3人拼團

微信客服

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

幫助反饋 APP下載

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

公眾號

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

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!