Reputation: 33755
I will eventually learn how to write CoffeeScript, but I just need this translated into CoffeeScript right now. Anyone care to take a stab at it?
function animate_favorite($favorite) {
$favorite.addClass('active');
var card = $favorite.parent().parent().parent();
var card_id = card.attr('id');
setTimeout(function() {
$('#' + card_id).find('.card-favorite-count').removeClass('active');
},1200);
}
Thanks.
Upvotes: 0
Views: 61
Reputation: 67505
I think the best solution is Js2Coffee verry simple website that convert in the both ways Js to coffee and the opposite.
Your coffee code :
animate_favorite = ($favorite) ->
$favorite.addClass 'active'
card = $favorite.parent().parent().parent()
card_id = card.attr('id')
setTimeout (->
$('#' + card_id).find('.card-favorite-count').removeClass 'active'
return
), 1200
return
Upvotes: 2