为了账号安全,请及时绑定邮箱和手机立即绑定

透明值不为整值1,而是0.83。我找不原因

透明值不为整值1,而是0.83。我找不原因

情积雪 2016-05-22 23:12:04
<script type="text/javascript">window.onload = function(){ var content = document.getElementsByClassName('content')[0]; var A = document.getElementsByTagName('a'); for(var i = 0; i<A.length; i++){ A[i].onmouseenter = function(){ var _this = this.getElementsByTagName('i')[0]; move(_this,{top:-25,opacity:0},function(){ _this.style.top=35 + 'px'; move(_this,{top:20,opacity:100}); }); } } } function move(obj,json,fu){ clearInterval(obj.time); obj.time = setInterval(function(){ for(var attr in json){ var flag = true; var icur = 0; if(attr == 'opacity'){ icur = Math.round(parseFloat(getStyle(obj,attr))*100); }else{ icur = parseInt(getStyle(obj,attr)); } var speed = 0; speed = (json[attr] - icur)/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); if(icur != json[attr]){ flag = false; } if(attr == 'opacity'){ obj.style[attr] = (icur + speed)/100; obj.style.filter='alpha(opacity:'+(icur+speed)+')'; }else{ obj.style[attr] = icur + speed + 'px'; } if(flag){ clearInterval(obj.time); if(fu){ fu(); } } } },10); } function getStyle(obj,attr){   if(obj.currentStyle){    return obj.currentStyle[attr];   }else{    return getComputedStyle(obj,false)[attr];   }}</script>
查看完整描述

1 回答

?
一杯2块的奶茶

TA贡献226条经验 获得超75个赞


html代码呢

查看完整回答
反对 回复 2016-05-24
  • 1 回答
  • 0 关注
  • 1222 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信