• 慕课网javascript动画特效 多透明度 源代码


    慕课网javascript动画特效 多透明度 源代码
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>多物体运动</title>
    <style>

    div{
    200px;
    height:100px;
    background:yellow;
    margin-bottom: 20px;
    filter:alpha(opacity:0.3);
    opacity:0.3;
    }
    </style>
    <script>
    window.onload=function(){
    var ali=document.getElementsByTagName('div');
    for(var i=0;i<ali.length;i++){
    ali[i].alpha=30;
    ali[i].timer=null
    ali[i].onmouseover=function(){
    startMove(this,100);
    }
    ali[i].onmouseout=function(){
    startMove(this,30);
    }
    }
    }
    // var timer=null;
    // var alpha=30;
    // ali[i].alpha=30;
    function startMove(obj,iTarget){
    clearInterval(obj.timer);
    obj.timer=setInterval(function(){
    var speed=0;
    if(obj.alpha>iTarget){
    speed=-10;
    }else{
    speed=10;
    }if(obj.alpha==iTarget){
    clearInterval(obj.timer);
    }
    else{
    obj.alpha+=speed;
    obj.style.filter='alpha(opacity:'+obj.alpha+')';
    obj.style.opacity=obj.alpha/100;
    }
    },30)
    }
    </script>
    </head>
    <body>
    <div id="div1"></div>
    <div id="div2"></div>
    <div id="div3"></div>
    <div id="div4"></div>
    </body>
    </html>
    慕课网地址http://www.imooc.com/video/2880
  • 相关阅读:
    csuoj 漫漫上学路
    sql函数
    sql基本
    查看webdriver API
    Jmeter应用-接口测试
    http协议
    Jmeter .jmx 改为.jtl
    Jmeter遇到打不开的问题
    测试要点
    apt-get安装mysql
  • 原文地址:https://www.cnblogs.com/milkytea/p/6986143.html
Copyright © 2020-2023  润新知