我想设计一个带有检查点的表,它应该能够在输入值时显示“第 x 行”/单击时跳转 x 行。它是一个滚动表,如:
每次单击“下一步”时,它都应该跳转“x 行” 谁能提出一些建议?
最佳答案
我已经更新了 fiddle 。检查那个。它正在按照您的要求工作。
代码:
var len = $('tr').length;
var index = 1;
function selectRows(start,end){
$('tr').not($('.tblhead')).hide();
$('tr').slice(start,end).show();
}
selectRows(index, index + 5);
$('a#next').click(function(){
if(index < len -5){
index = index + 5;
selectRows(index, index + 5);
}
});
$('a#prev').click(function(){
if(index > 1){
selectRows(index-5, index);
index = index - 5;
}
});
关于javascript - 滚动条表检查点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8868500/