I'm trying to use this in coffeescript :
$(this).hide().each (index) ->
$(this).delay(index * 100).fadeIn 1000, arguments.callee
$(this).promise().done -> console.log 'hey trip'
The same thing in au naturale JS
$(this).hide().each(function(index) {
$(this).delay(index * 100).fadeIn(1000, arguments.callee)
});
$(this).promise().done(function() {console.log 'hey trip' });
And I'd like to execute the console log once the animation is complete. But this snippet here never delivers the console message ( in general ), let alone when the animation completes.
Anyone know how to use the promise objects appropriately?
Second Failing Attempt :
promise = new $.Deferred ->
promise.done -> console.log 'hey trip'
promise.resolve( $(this).hide().each (index) ->
$(this).delay(index * 100).fadeIn 3000, arguments.callee
)
Third failing Variation
dfd = $.Deferred ->
dfd.done(
$(this).hide().each (index) ->
$(this).delay(index * 100).fadeIn(3000, arguments.callee)
).done -> console.log 'hey trip'
Fourth failing variation
$.when(
$(this).hide().each (index) ->
$(this).delay(index * 100).fadeIn(3000, arguments.callee)
).then -> console.log 'hey trip'