我正在尝试替换元素的内容,几秒钟后做一些事情,然后在那之后的半秒钟内把原始的内容放回去。这是我的密码:
HTML:
<div id="swap">original text</div>联署材料:
var oldHtml = $("#swap").html();
$("#swap").html("new text").delay(2000).queue(function() {
console.log('first queue');
// do something cool
}).delay(500).queue(function() {
console.log('second queue');
$("#reportProblemFormContainer").html(oldHtml);
});JSFIDDLE:http://jsfiddle.net/NDwG6/
输出是
first queue为什么第二次延迟/延迟不起作用?有办法让这件事起作用吗?
发布于 2014-01-07 17:59:55
调用next()来排除当前任务的队列。更新的JSFiddle http://jsfiddle.net/NDwG6/1/
https://stackoverflow.com/questions/20978425
复制相似问题