5个回答
- /***
- **表格内容自动轮播脚本
- **@param tableDom内容滚动的表格,最好是表格的父DIV
- **@param visibleHeight 可视区的高度
- ***/
- function autoScrollTable(tableDom, visibleHeight) {
- var marqueesHeight = visibleHeight;
- var stopscroll = false;
- var scrollElem = tableDom;
- var preTop = 0;
- var currentTop = 0;
- var stoptime = 0;
- with (scrollElem) {
- style.height = parseFloat(marqueesHeight) + "px";
- style.overflow = 'hidden';
- noWrap = true;
- }
- var scrollUp = function () {
- if (stopscroll) {
- setTimeout(scrollUp, 50);
- return;
- }
- currentTop += 1;
- if (currentTop == (marqueesHeight + 1)) {
- stoptime += 1;
- currentTop -= 1;
- if (stoptime == 1) {
- currentTop = 0;
- stoptime = 0;
- }
- } else {
- preTop = scrollElem.scrollTop;
- scrollElem.scrollTop += 1;
- if (preTop == scrollElem.scrollTop) {
- scrollElem.scrollTop = 0;
- scrollElem.scrollTop += 1;
- }
- }
- setTimeout(scrollUp, 50);
- };
- var restartScroll = function () {
- scrollElem.scrollTop = 0;
- setTimeout(scrollUp, 50);
- };
- jQuery(tableDom).hover(function () {
- stopscroll = true;
- }, function () {
- stopscroll = false;
- });
- setTimeout(restartScroll, 2000);
- }
- autoScrollTable(document.getElementById('GRID2'),document.getElementById("HHH148").clientHeight);
把这段的GRID2换成表格的代码.HHH148换成容器的代码
autoScrollTable(document.getElementById('GRID2'),document.getElementById("HHH148").clientHeight);
另外清一下浏览器缓存
shaoshl 发表于 2021-9-17 10:35
把这段的GRID2换成表格的代码.HHH148换成容器的代码
autoScrollTable(document.getElementById('GRID2'), ...
这个脚本在哪修改自动刷新时间啊