刚开始滚动速度是可以的,然后越来越快,看不清的快;因为页面中有参数选择,用setTimeout函数选择参数后更新报表块数据会出现滚动条,所以用的setInterval函数,没有用setTimeout函数,报表块数据滚动:setInterval(function() {var $report = $("div");//获取对应report的div元素var $scroll = $report.find("#frozen-center");//获取对应report的div元素的滚动块元素,冻结为#frozen-center,未冻结且未安装自定义滚动条插件为.reportContent,未冻结且安装了自定义滚动条插件为.scrollDivvar flag = window.flag0;//设置全局变量flag,每个报表块需保证各不相同$report.find("#frozen-center").css('overflow-x', 'hidden');$report.find("#frozen-center").css('overflow-y', 'hidden');$report.find("#frozen-north").css('overflow-x', 'hidden');$report.find("#frozen-north").css('overflow-y', 'hidden');//冻结情况下隐藏滚动条$report.find(".reportContent").css('overflow-y', 'hidden');$report.find(".reportContent").css('overflow-x', 'hidden');//非冻结情况下隐藏滚动条flag = true;//定义全局参数flag,用来控制滚动的暂停和继续$scroll.mouseover(function() {flag = false;})//鼠标悬浮,滚动停止$scroll.mouseleave(function() {flag = true;})//鼠标离开,继续滚动var old = -1;setInterval(function() {if (flag) {currentpos = $scroll.scrollTop;//获取距顶部距离if (currentpos == old) {$scroll.scrollTop = 0;//若已到达底部,则重置} else {old = currentpos;$scroll.scrollTop = currentpos + 1.5;//若未到达底部,则向下移动1.5像素}}}, 50);//以25ms的频率执行}, 1000);