-
zzw123 数据小白Lv1
发表于2023-3-9 15:11
悬赏1
未解决
楼主
/***
**表格内容自动轮播脚本
**@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('GRID13'),document.getElementById("HHH134").clientHeight);
autoScrollTable(document.getElementById('GRID16'),document.getElementById("HHH135").clientHeight);
autoPlay(500,null,function(){
autoScrollTable(document.getElementById('GRID13'),document.getElementById("HHH134").clientHeight);
autoScrollTable(document.getElementById('GRID16'),document.getElementById("HHH135").clientHeight);
});
**表格内容自动轮播脚本
**@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('GRID13'),document.getElementById("HHH134").clientHeight);
autoScrollTable(document.getElementById('GRID16'),document.getElementById("HHH135").clientHeight);
autoPlay(500,null,function(){
autoScrollTable(document.getElementById('GRID13'),document.getElementById("HHH134").clientHeight);
autoScrollTable(document.getElementById('GRID16'),document.getElementById("HHH135").clientHeight);
});
2个回答
玳玳我 发表于 2023-3-9 17:39
页面定时刷新脚本怎么写的
autoPlay(500,null,function(){
autoScrollTable(document.getElementById('GRID13'),document.getElementById("HHH134").clientHeight);
autoScrollTable(document.getElementById('GRID16'),document.getElementById("HHH135").clientHeight);
});