我有一张桌子,我通过溢出使它可以滚动:auto; 现在我想知道垂直滚动条是否到达底部,以便我可以显示在页面加载时隐藏的下 5 行。无论我在哪里搜索互联网,它都使用 window.height() .... 但我不需要使用 window,因为我的元素仅限于 iframe 中的表格。
这是表结构
<div class="responsive" style="height:150px; overflow:hidden;" >
<table class="responsive table table-bordered dataTable" id="checkAllEmail" >
<thead>
<tr style="display:block;">
<th class="serial" style="width:57px;">#</th>
<th style="width:156px;">Display Name</th>
<th class="tableButton" style=" text-align:center!important; width:147px;">Actions</th>
</tr>
</thead>
<tbody id="mailServerTbody" style="height:113px; overflow:auto; display:block;">
</tbody>
</table>
</div>
这是我在 js 中尝试做的事情
$(document).ready(function(){
var div=0;
$('#mailServerTbody').scroll(function(){
var temp = $(this).scrollTop();
console.log($("#mailServerTbody").position().top+"blah")
console.log(temp)
if((temp%32==0)||(temp%32==17)){
console.log("enter")
div = div+4;
//div = div*5-1;
console.log(temp/32+"temp")
$('#mailServerTbody tr:gt('+div+'):lt(5)').show();
}
});
});