隐藏滚动条并且自动滚动的js:setTimeout(function() { AutoScroll(); //定义需要跑马灯效果的报表块名字,兼容大小写}, 2000);function AutoScroll(e) { for (i = 0; i < e.length; i++) { (function(e, i) { scroll(e, i); })(e, i); }}function scroll(e, i) { var $report = $("div.toUpperCase() + "]"); //获取对应report的div元素 var $scroll; if ($report.find(".frozen-center").length != 0) { $scroll = $report.find(".frozen-center"); } else if ($report.find(".scrollDiv").length != 0) { $scroll = $report.find(".scrollDiv"); } else { $scroll = $report.find(".reportContent"); } //判断是否冻结以及是否安装自定义滚动条插件 var flag = eval("window.flag" + i); //设置全局flag,控制悬停 if (interval) { clearInterval(interval); } //清除定时器,避免越滚越快 var interval = eval("window.interval" + i); $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; $scroll.mouseover(function() { flag = false; $report.find("#frozen-center").css('overflow-x', 'hidden'); $report.find("#frozen-center").css('overflow-y', 'auto'); $report.find("#frozen-north").css('overflow-x', 'hidden'); $report.find("#frozen-north").css('overflow-y', 'auto'); }) //鼠标悬浮,滚动停止 $scroll.mouseleave(function() { flag = true; $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'); }) //鼠标离开,继续滚动 var old = -1; interval = setInterval(function() { if (flag) { currentpos = $scroll.scrollTop; //获取距顶部距离 if (currentpos == old) { $scroll.scrollTop = 0; //若已到达底部,则重置 } else { old = currentpos; $scroll.scrollTop = currentpos + 1.0; //若未到达底部,则向下移动1.0像素 } } }, 100); //以100ms的频率执行}