2013-07-18 67 views
1

我正在使用Bootstrap和jqcloud,並發現jqcloud在添加Bootstrap時停止工作。這個問題與jquery中的版本有關。我要求幫助,這聲明,失敗:jqcloud和自舉衝突

$("#headerwordcloud").jQCloud' is not a function 
$("#headerwordcloud").jQCloud(hword_list); 

對於JQCLOUD

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js"></script> 
<script type="text/javascript" src="./js/wordcloud.js"></script> 
<link rel="stylesheet" type="text/css" href="./css/jqcloud.css" /> 
<script type="text/javascript" src="./js/jqcloud-1.0.4.js"></script> 

新代碼,實現自舉

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> 
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> 
    <!--[if lt IE 9]> 
     <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> 
    <![endif]--> 
    <link rel="shortcut icon" href="/bootply_ico.jpg"> 
    <link rel="apple-touch-icon" href="/bootstrap/img/apple-touch-icon.png"> 
    <link rel="apple-touch-icon" sizes="72x72" href="/bootstrap/img/apple-touch-icon-72x72.png"> 
    <link rel="apple-touch-icon" sizes="114x114" href="/bootstrap/img/apple-touch-icon-114x114.png"> 

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> 

    <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> 
    <script src="/plugins/jquery.layout.js"></script> 

    <link href="/plugins/jquery.layout.css" rel="stylesheet"> 
    <link rel="stylesheet" href="/plugins/bootstrap-select.min.css"> 
    <link rel="stylesheet" href="/css/bootply.css"> 
    <link rel="stylesheet" href="/bootply/themes/metroid/theme.css"> 

回答

0

當您覆蓋jQCloud在第二次加載jQuery時將添加到jQuery/$對象的方法時,您正在加載腳本的方式。加載jQuery和jQuery UI的第一,然後加上取決於他們的插件:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> 
<script type="text/javascript" src="./js/wordcloud.js"></script> 
<script type="text/javascript" src="./js/jqcloud-1.0.4.js"></script> 
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> 
<script src="/plugins/jquery.layout.js"></script> 

注意,我在示例中省略的樣式表。

在這種jQCloud需要的jQuery的舊版本的(不太可能)情況下,你可以使用an approach like this

+0

我解決了它最後通過移動的jquery包括接近列表的末尾 – user2580874