Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.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 使用CoffeeScript调用jQuery库_Javascript_Jquery_Coffeescript - Fatal编程技术网

Javascript 使用CoffeeScript调用jQuery库

Javascript 使用CoffeeScript调用jQuery库,javascript,jquery,coffeescript,Javascript,Jquery,Coffeescript,我想在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:

我想在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

但是
$
与jQuery是一样的。假设您已经创建了
$chart
,那么第二个也是有效的。

将是相同的
$(“#chart”)。jQCloud(单词列表)在咖啡中我知道了,我该如何创建图表?