Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将jQuery数据表滚动到所需行_Javascript_Jquery_Scroll - Fatal编程技术网

Javascript 将jQuery数据表滚动到所需行

Javascript 将jQuery数据表滚动到所需行,javascript,jquery,scroll,Javascript,Jquery,Scroll,我有一个jQuery数据表 var oTable = $('#table1').dataTable({ 'aaData': data, 'aoColumns': cols, 'bScrollInfinite': true, 'bScrollCollapse': true, 'sScrollY': '200px' }); 我想滚动到表格的最后一行。它目前有500行 $('#table1').scrollTo($('#table tbod

我有一个jQuery数据表

var oTable = $('#table1').dataTable({
      'aaData': data,
      'aoColumns': cols,
      'bScrollInfinite': true,
      'bScrollCollapse': true,
      'sScrollY': '200px'
});
我想滚动到表格的最后一行。它目前有500行

$('#table1').scrollTo($('#table tbody tr').last(), 800);
上述代码不起作用

无论如何,当我瞄准
body
tag时

$('body').scrollTo('900px', 800);
它很好用


我正在使用插件

我相信它需要像素值作为参数,请尝试以下代码:

$('#table1').scrollTo($('#table tbody tr').last().offset().top, 800);

嗯,我认为你需要把你的HTML放到你的问题中。或者你可以做一把小提琴。。无论如何,你确定它是
#table
而不是
#table1