jquery tablesorter垂直滚动不工作

时间:2016-08-13 11:03:24

标签: php html css html-table tablesorter

我在我的应用程序中使用jquery tablesorter表。我想为tbody和overflow-y scroll添加一个最大高度。

<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>jsmith@gmail.com</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?

1 个答案:

答案 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/

相关问题