if(window.interval){clearInterval(window.interval);}//判断之前是否执行过该代码,如果有,就停止之前的执行setTimeout(function() { //隐藏报表块report0的滚动条(此报表块名为report0,根据具体情况修改) $("div").find(".frozen-north").css({ 'overflow-x':'hidden', 'overflow-y':'hidden' }); $("div").find(".frozen-center").css({ 'overflow-x':'hidden', 'overflow-y':'hidden' }); },1000); window.flag1 = true;var self1 = this;//鼠标悬停,滚动停止setTimeout(function() { $("div").find(".frozen-center").mouseover(function() { window.flag1 = false; }); //鼠标离开,继续滚动 $("div").find(".frozen-center").mouseleave(function() { window.flag1 = true; }); var isDown1 = true; var camera= $("div").find(".frozen-center"); window.interval = setInterval(function() { if (!self1.isVisible()) { return; } if (window.flag1) { if (isDown1) { camera.scrollTop++; //下降 //如果滚动条超过100的话,就往上 //可以修改这个条件,作为折返的前提 if (camera.scrollTop+camera.clientHeight > camera.scrollHeight-1) { isDown1 = false; } } else { camera.scrollTop--; //上升 //到达顶部的话,就下降 if (camera.scrollTop == 0) { isDown1 = true; } } } }, 25);//移动的速度},1000);