2015-09-13 64 views
1

爲什麼我的Bootstrap表底部的頁面大小下拉菜單(「每頁顯示10條記錄」)爲什麼在某些環境下工作,但在其他環境下工作,我感到非常困惑。我想創建一個Bootstrap Table,其分頁功能就像this一樣。當我通過Sublime Text或Brackets(Adobe的文本編輯器)預覽代碼時,下拉菜單不起作用。當我將我的代碼插入到頁面底部的my Squarespace blog時,它也不起作用。但是,當我將代碼插入到JSFiddle或我的Webflow site時,它的工作。什麼可能導致衝突?我是編程新手,希望能告訴我一些關於如何解決問題的提示!爲什麼Bootstrap的下拉菜單在某些環境下工作,但不是其他人?

<!-- Latest compiled and minified CSS --> 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.css"> 

<!-- Latest compiled and minified CSS --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
<table data-toggle = "table" data-pagination = "true" data-pagination = "true" data-page-list="[10, 20, 50, 100, 200]"> 
    <thead> 
     <tr> 
      <th data-sortable="true">Symbol</th> 
      <th data-sortable="true">Company Name</th> 
      <th data-sortable="true">EV/EBITDA</th> 
      <th data-sortable="true">Trailing P/E</th> 
      <th data-sortable="true">Forward Dividend Yield</th> 
      <th data-sortable="true">Payout Ratio</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>FLWS</td> 
      <td>1-800 FLOWERS.COM, Inc.</td> 
      <td>9.18</td> 
      <td>28.33</td> 
      <td>N/A</td> 
      <td>N/A</td> 
     </tr> 
     ... 
    </tbody> 
</table> 
<!-- Latest compiled and minified JavaScript --> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> 

<!-- Latest compiled and minified JavaScript --> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.js"></script> 

回答

4

的jQuery之前需要引導的JS文件(S)被加載:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> 

<!-- Latest compiled and minified JavaScript --> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 

<!-- Latest compiled and minified JavaScript --> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.js"></script> 

它的工作原理上的jsfiddle,因爲它們產生的標記是正確號令庫。如果您在Stack Snippet中以相同的順序加載庫,則會在該網站上看到相同的行爲。

值得一提的是,這是顯式調用出來Bootstrap's site

另外請注意,所有的插件依賴jQuery的(這意味着jQuery的必須是 插件文件之前,包括)。

相關問題