我想要做類似這樣的事情在CoffeeScript中:調用jQuery庫與CoffeeScript的
word_list = [{ text: "cat", weight: 23 }, { text: "mouse", weight: 10 }, { text: "fox", weight: 5}, { text: "lion", weight: 4}, { text: "giraffe",weight: 3}, {text: "zebra", weight: 2},{ text: "bat", weight: 20 }, { text: "rat", weight: 11 }, { text: "duck", weight: 4}, { text: "dinosaur", weight: 100}, { text: "flamingo",weight: 50}, {text: "kangaroo", weight: 8},]
$(function() {
$("#chart").jQCloud(word_list);
});
我會做出這樣的電話嗎?
jQuery ->
$("#chart").jQCloud(word_list);
或者我需要做的是這樣
$ ->
$chart.jQcloud(word_list);
會是相同的'$(「#chart」)。jQCloud(word_list);'在咖啡 –