Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery动画立即发生(使用角度)_Jquery_Angularjs_Animation - Fatal编程技术网

jquery动画立即发生(使用角度)

jquery动画立即发生(使用角度),jquery,angularjs,animation,Jquery,Angularjs,Animation,我正试图通过使用jQuery.animate设置其css属性的动画来移动div(itemEl)。我的代码在plunker()中工作,但是当尝试将其移植到我的项目时,动画中断了。也就是说,div实际上被移动到了正确的位置,但这种情况会立即发生,而不是随着时间的推移。这是我的指令控制器的摘录: // draw item in fixed position itemEl.css({ position :'absolute', top : itemE

我正试图通过使用jQuery.animate设置其css属性的动画来移动div(itemEl)。我的代码在plunker()中工作,但是当尝试将其移植到我的项目时,动画中断了。也就是说,div实际上被移动到了正确的位置,但这种情况会立即发生,而不是随着时间的推移。这是我的指令控制器的摘录:

// draw item in fixed position
itemEl.css({
    position        :'absolute',
    top             : itemElPos.top,           
    left            : itemElPos.left,                
    width           : itemElDim.width,
    height          : itemElDim.height,
});



// move item to overlap mainItem
var animationPointer = itemEl.animate({
        position  : 'absolute',
        top     : mainItemElPos.top,                
        left    : mainItemElPos.left,               
        width   : mainItemElDim.width,
        height  : mainItemElDim.height,
    },
    1000,
    function(mainItem, itemEl){return function(){

       // process after animation

    };}(mainItem, itemEl)
);
有人知道我应该在哪里解决这个问题吗?也许jqueryanimate和angular的ngAnimate之间存在兼容性问题?或者某些不推荐使用的方法或某些全局设置。。。我不知道:p

----------------------------已解决:


事实证明jQuery.animate()和datejs之间存在兼容性问题。由于某种原因,Datejs会覆盖Date.now,导致返回的是日期对象而不是整数。修改datejs的源代码解决了我的问题

你们能发布一段不起作用的代码吗?不幸的是我不能,这是我正在进行的一个更大项目的一部分。我发布的摘录来自我正在使用的自定义指令的控制器中的一个方法。它是通过模板内的ng单击调用的。通过调试,我可以看到代码确实执行了,没有收到错误或警告,并且div实际移动了。但它会立即移动,就好像延迟时间被设置为0,而不是1000毫秒。由于问题是由问题之外的东西引起的,因此任何人都很难提供帮助。我能给你的最好建议是复制一份你的项目,并尽可能多地删除,直到这一点点开始起作用……然后也许你可以发布任何处于临界点的代码。