账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    本人新手一枚,调用js运动框架,链式运动无法运行,一直找不出原因 ,各位老师帮忙看看呗
    • 2017-09-15 00:00
    • 10
    31
    0

    1.本人新手一枚,调用运动框架,链式运动无法运行,一直找不出原因 ,各位大神帮忙看看呗~
    2.

    window.onload=function () {
            var oBut=document.getElementById('but')
            var oBottom=document.getElementById('zns_bottom')
            var oBox=document.getElementById('zns_box')
            oBut.onclick=function () {
    
                startMove(oBottom,{right:0},function () {
                    startMove(oBox,{bottom:0})
                })
            }
        }
    
    
    function startMove(obj,json,fnEnd) {
        clearInterval(obj.timer);
        var alpha
        obj.timer=setInterval(function () {
            for(var arr in json){
            var cur=0
            if (arr=='opacity'){
                cur=Math.round(parseFloat(getStyle(obj,arr))*100);
            }
            else{
                cur=parseInt(getStyle(obj,arr));
            }
            var speed=(json[arr]-cur)/6;
            speed=speed>0?Math.ceil(speed):Math.floor(speed);
            if (cur==json[arr]){
                clearInterval(obj.timer);
    
                if(fnEnd)fnEnd();
            }
            else{
                if (arr=='opacity'){
                    obj.style.opacity=(cur+speed)/100;
                    obj.style.filter='alpha(opacity:'+alpha+speed+')'
                }
                else{
                    obj.style[arr]=cur+speed+'px';
                }
    
            }}
                
        },30)
    }
    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 10 元积分
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部