2016-08-13 97 views
1

我在我的应用程序中使用jquery tablesorter表。我想为tbody和overflow-y滚动添加最大高度。jquery tablesorter垂直滚动不工作

<table id="myTable" class="tablesorter"> 
<thead> 
<tr> 
    <th>Last Name</th> 
    <th>First Name</th> 
    <th>Email</th> 
    <th>Due</th> 
    <th>Web Site</th> 
</tr> 
</thead> 
<tbody> 
<tr> 
    <td>Smith</td> 
    <td>John</td> 
    <td>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.jsmith.com</td> 
</tr> 

</tbody> 
</table> 

我添加

.tablesorter thead{ 
display:block; 
} 
.tablesorter tbody{ 
    height: 200px; 
    overflow-y: auto; 
    overflow-x: hidden; 
    display: block ; 
} 

但它不是采取...有没有什么办法来添加此功能tablesort?

+0

遗憾的漏点,它不工作还 –

回答

0

您在表名的类名前缺少.

你的CSS代码应该是这样的,

.tablesorter thead{ 
display:block; 
} 
.tablesorter tbody{ 
    height: 200px; 
    overflow-y: auto; 
    overflow-x: hidden; 
    display: block ; 
} 

应该.tablesorter tbody而不是tablesorter tbody

演示:(。)https://jsfiddle.net/ybb7aw47/