2015-10-08 70 views
0

我想使用jQuery的floatThead插件。看起來有些失蹤。我通讀了教程。任何人都可以幫助我。我附上一個JSFiddle。幫助讚賞。使用jquery floatthead修復了HTML標頭。

<div class="wrapper"> 

<table class="table demo1 table-bordered table-striped"> 
    <thead> <tr> <th><a href="#" id='demoHeader1'>Header 1</a></th> 
     <th><a href="#" id='demoHeader2'>Header 2</a></th> <th><a href="#" id='demoHeader3'>Header...3</a></th> </tr> </thead> 
    <tbody> 
    <tr> <td>Cell Content 1</td> <td>Cell Content 2</td> <td>Cell Content 3</td> </tr> 
    <tr> <td>More Cell Content 1</td> <td>More Cell Content 2</td> <td>More Cell Content 3</td> </tr> 
    <tr> <td>Even More Cell Content 1</td> <td>Even More Cell Content 2</td> <td>Even More Cell Content 3</td> </tr> 
    <tr> <td>And Repeat 1</td> <td>And Repeat 2</td> <td>And Repeat 3</td> </tr> <tr> <td>Cell Content 1</td> <td>Cell Content 2</td> <td>Cell Content 3</td> </tr> 
    <tr> <td>More Cell Content 1</td> <td>More Cell Content 2</td> <td>More Cell Content 3</td> </tr> 
    <tr> <td>Even More Cell Content 1</td> <td>Even More Cell Content 2</td> <td>Even More Cell Content 3</td> </tr> 
    <tr> <td>And Repeat 1</td> <td>And Repeat 2</td> <td>And Repeat 3</td> </tr> 
    <tr> <td>Cell Content 1</td> <td>Cell Content 2</td> <td>Cell Content 3</td> 
    </tr> <tr> <td>More Cell Content 1</td> <td>More Cell Content 2</td> <td>More Cell Content 3</td> </tr> 
    <tr> <td>Even More Cell Content 1</td> <td>Even More Cell Content 2</td> <td>Even More Cell Content 3</td> </tr> 
</table> 

https://jsfiddle.net/otyy8svy/

+0

預期的行爲是什麼?你是否收到任何錯誤訊息? –

回答

0

整個問題是,你還沒有添加插件代碼到你的演示。這樣你有一個控制檯錯誤$demo1.floatThead is not a function

也許他們已經刪除了他們在cloudflare上託管的代碼。所以,也許這是你的問題。 https://cdnjs.cloudflare.com/ajax/libs/floatthead/1.2.11/jquery.floatThead.js

解決方案

我已經添加了代碼plugin's official website到小提琴JS箱和東西的工作。

https://jsfiddle.net/psy8Lzpk/

所以,get the code,幷包括到託管到自己的服務器floatThead.js文件,將其鏈接到頁面上方的主要js文件和快樂。