【发布时间】:2015-07-07 15:24:27
【问题描述】:
我有以下代码 sn-p,它试图每 100 毫秒获取动画对象的实际位置。
$scope.getPositionOfTheSpiderOnTheRope = function() {
$interval(function () {
var positionOfTheSpider = $('#spiderTwo').position();
console.log(positionOfTheSpider.top);
}, 100);
}
动画功能如下:
$scope.animateSpiderOne = function () {
$('#spiderTwo').velocity({
"margin-top": '+=20%',
}, 4500, function () {
console.log("MOVE DOWN END");
$('#spiderTwo').velocity({
"margin-top": '-=20%',
}, 4500, function () {
console.log("MOVE UP END");
$scope.animateSpiderOne();
});
});
};
问题是动画正在动画,但返回值仍然相同而没有变化。
请问如何解决?
【问题讨论】:
标签: jquery css css-animations velocity.js