1 scrollBar(); 2 function scrollBar() { 3 height = $('.layui-table-body').height(); 4 var number = 0; 5 var length = 0; 6 var time = setInterval(function () { 7 number += 1; 8 if (number == 12) { 9 clearInterval(time);10 $('.layui-table-body').scrollTop('0');11 } else {12 length += height / 11;13 $('.layui-table-body').scrollTop(length); //只有此处有区别14 }15 }, 1000);16 }17 18 setInterval(function () {19 scrollBar()20 }, 13000)