Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.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
Javascript 如何在添加类时设置顺序延迟?_Javascript_Jquery_Animation_Coffeescript_Underscore.js - Fatal编程技术网

Javascript 如何在添加类时设置顺序延迟?

Javascript 如何在添加类时设置顺序延迟?,javascript,jquery,animation,coffeescript,underscore.js,Javascript,Jquery,Animation,Coffeescript,Underscore.js,我正在使用jQueryUI插件和最新的jQuery 我想按顺序添加类,一个接一个地添加我的元素数组。现在我有这个: $(@el).addClass("gridBoxComplete", 400, "easeOutBounce").delay(800) 其中,@el是数组中的当前元素。但是,这不会在运行迭代中的下一项之前延迟此对象。我根据这个想法制作了这个动画 $(@).hide().each (index) -> $(@) .delay(index * 100) .f

我正在使用jQueryUI插件和最新的jQuery

我想按顺序添加类,一个接一个地添加我的元素数组。现在我有这个:

$(@el).addClass("gridBoxComplete", 400, "easeOutBounce").delay(800)
其中,
@el
是数组中的当前元素。但是,这不会在运行迭代中的下一项之前延迟此对象。我根据这个想法制作了这个动画

$(@).hide().each (index) ->
  $(@)
    .delay(index * 100)
    .fadeIn 500
delay()
延迟动画,而不是类名更改或其他代码执行。如果需要一般执行延迟,请使用
setTimeout
或类似的方法:

$.fn.wait = function(ms, callback) {
  return this.each(function() {
    setTimeout(callback.bind(this), ms)
  })
}

$(@el).addClass("gridBoxComplete", 400, "easeOutBounce").wait(800, function() {
    $(this).addClass("something");
});
delay()
延迟动画,而不是类名更改或其他代码执行。如果需要一般执行延迟,请使用
setTimeout
或类似的方法:

$.fn.wait = function(ms, callback) {
  return this.each(function() {
    setTimeout(callback.bind(this), ms)
  })
}

$(@el).addClass("gridBoxComplete", 400, "easeOutBounce").wait(800, function() {
    $(this).addClass("something");
});

我不知道cofeecrap的作用是什么,但是
delay()
是用于动画,而不是用于添加类,请使用超时。你们中的任何一位知道我能读到的对coffeescript的批评的好来源吗?到目前为止,我只玩得很开心。我不知道咖啡渣会做什么,但是
delay()
是用于动画,而不是用于添加类,请使用超时。你们中的任何一位知道我能读到的对咖啡脚本的批评的好来源吗?到目前为止,我只玩得很开心..嗯。。此自定义函数正在返回
意外标识符
Hmmm。。此自定义函数正在返回
意外标识符