javascript-调用stop时,jquery动画队列promise会发生什么

我想知道当调用.stop()函数时动画队列承诺状态会发生什么.

例如:

$('.my-elem')
    .stop(true, true)
    .animate({})
    .promise()
    .always(function() {
        // do something
    })

如果.stop()函数在任何时候被调用,那么较早返回的承诺会发生什么?

现在,我感觉到承诺的兑现将永远保持下去.有什么线索吗?

解决方法:

停止动画将解决承诺.

//start the anim and alert 'done' on deferred resolution
$('div').animate({height: 500}, 3000).promise().done(function() {
    alert('deferred resolved');
});

//interrupt it after 1 second
setTimeout(function() { $('div').stop(); }, 1000);

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...