• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

同时运动可以,链式,同时一起就不可以。大家帮我看看,我错哪了T T

// JavaScript Document
window.onload=function(){
var Li1=document.getElementById('li1');
     Li2=document.getElementById('li2');
Li1.onmouseover=function(){
  Move(Li1,{width:400,height:200,opacity:100},function(){
   Move(Li1,{width:200,height:150,opacity:70});
   })
  }
Li1.onmouseout=function(){
  Move(Li1,{width:200,height:100,opacity:30})
  }
Li2.onmouseover=function(){
  Move(Li2,{width:400,height:200,opacity:100})
  }
Li2.onmouseout=function(){
  Move(Li2,{width:200,height:100,opacity:30})
  }
}
function Move(obj,json,fn){
  clearInterval(obj.timer);
  obj.timer=setInterval(function(){
   var flag=true;//假设所有运动都达到目标值
   for(var attr in json)//获开当前值
   {
   
   var icor=0
   if(attr=='opacity'){
    icor=Math.round(parseFloat(getStyle(obj,attr))*100);
    }
   else{
    icor=parseInt(getStyle(obj,attr));
    }
   var speed=(json[attr]-icor)/10;
   speed=speed>0?speed=Math.ceil(speed):speed=Math.floor(speed);
   if(icor!=json[attr]){
    flag=false;
         } //对flag真假的定义 假的,继续执行以上函数。
   if(attr=='opacity'){
    obj.style.filter='alpha(opacity:'+(icor+speed)+')';
    obj.style.opacity=(icor+speed)/100;
     }
   else{
    obj.style[attr]=icor+speed+'px';
     }
        }//json for结束
   if(flag){
    clearInterval(obj.timer)
    if(fn){
     fn();
     }
    }//若flag为真
   },50)}
function getStyle(obj,attr){
  if(obj.currentStyle){
   return obj.currentStyle[attr];
   }
  else{
   return getComputedStyle(obj,false)[attr];
   }
  }

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

没有html代码吗

使用道具 举报

发新帖

发布任务需求已有1031166位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!