2015-01-03 2 views
0

다른 애니메이션 div가 왼쪽 여백으로 100px에 도달하면 div의 위쪽 여백을 변경하고 싶습니다. 익명 함수로 시도했지만 작동하지 않습니다.일부 CSS 속성을 확인한 후 CSS 속성을 동적으로 변경하는 jquery

(function(){ 
"use strict"; 

var app = WinJS.Application; 
var activation = Windows.ApplicationModel.Activation; 
var animatedNumber; 


app.onactivated = function (args) { 
    if (args.detail.kind === activation.ActivationKind.launch) { 
     if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 

      animatedNumber = parseInt(Math.random()*10); 
      document.getElementById("animatedNumber").innerHTML = animatedNumber; 
      $("#animatedNumber").animate({ marginLeft: '900px' },1000); 


       if (parseInt($("#animatedNumber").css("marginLeft"))>= 100) 
        $("#A1").animate({ marginTop: '-=40px' }) 

     } else { 
      // TODO: This application has been reactivated from suspension. 
      // Restore application state here. 
     } 
     args.setPromise(WinJS.UI.processAll()); 
    } 
}; 

app.oncheckpoint = function (args) { 

}; 

app.start(); 
})();` 

답변

0

내가 간단,이 시도했다 :

다음

는 코드입니다.

대신

$("#animatedNumber").animate({ 
 
    marginLeft: '900px' 
 
}, 1000); 
 

 

 
if (parseInt($("#animatedNumber").css("marginLeft")) >= 100) { 
 
    $("#A1").animate({ 
 
    marginTop: '-=40px' 
 
    }) 
 
}

의이

$("#animatedNumber").animate({ 
 
    marginLeft: '100px' 
 
}, 150, function() { 
 

 
    // DO the margin top changes 
 
    $("#A1").animate({ 
 
    marginTop: '-=40px' 
 
    }); 
 

 
    //Now complete the rest of the animation 
 
    $(this).animate({ 
 
    marginLeft: '800px' 
 
    }, 750); 
 
});

,536,913 시도
관련 문제