-
-
zm1997 数据达人Lv4
发表于2021-1-12 15:54
悬赏1
已解决
楼主
红框中是轮换组件及容器的代号。
//---------参数配置start---------
//第一个参数是控件id
//第二个参数是轮播间隙时间单位是ms
var autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
//-------end----------
setInterval(function(){
if(!$("#HHH39").data("events")){
$("#HHH39").mouseover(function(){
if(autoslide){
window.clearInterval(autoslide);
autoslide = null;
}
});
}else{
if(!$("#HHH39").data("events")["mouseenter"]){
$("#HHH39").mouseover(function(){
if(autoslide){
window.clearInterval(autoslide);
autoslide = null;
}
});
}
}
},3000);
setInterval(function(){
if(!$("#HHH39").data("events")){
$("#HHH39").mouseout(function(){
if(!autoslide){
autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
}
});
}else{
if(!$("#HHH39").data("events")["mouseleave"]){
$("#HHH39").mouseout(function(){
if(!autoslide){
autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
}
});
}
}
},3000);
function autoShowSlide(block, time) {
var slide = g_rptpage.getWidgetByName(block);
if(!slide){
return ;
}
var gocount = slide.getGocount();//步数
//var pagesize = slide.getPagesize();
//var active = slide.getActive();
//暂时只考虑一次翻一页的情况
if (gocount == 1) {
//有子页面且子页面大于1页
var slidelist = slide.slidelist;
if (slidelist != null && slidelist.getSubCount() > 1){
if (slidelist.getActiveIndex() == slidelist.getSubCount() - 1) {
//最后一页调回第一页
//slidelist.setActivePage(0);
slide.setActive(0);
} else {
//slidelist.setActivePage(slidelist.getActiveIndex() + 1);
slide.setActive(slidelist.getActiveIndex() + 1);
}
}
}
};
是自动轮换的脚本,不能使用了,是哪里错了吗?请指点一下
//---------参数配置start---------
//第一个参数是控件id
//第二个参数是轮播间隙时间单位是ms
var autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
//-------end----------
setInterval(function(){
if(!$("#HHH39").data("events")){
$("#HHH39").mouseover(function(){
if(autoslide){
window.clearInterval(autoslide);
autoslide = null;
}
});
}else{
if(!$("#HHH39").data("events")["mouseenter"]){
$("#HHH39").mouseover(function(){
if(autoslide){
window.clearInterval(autoslide);
autoslide = null;
}
});
}
}
},3000);
setInterval(function(){
if(!$("#HHH39").data("events")){
$("#HHH39").mouseout(function(){
if(!autoslide){
autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
}
});
}else{
if(!$("#HHH39").data("events")["mouseleave"]){
$("#HHH39").mouseout(function(){
if(!autoslide){
autoslide = setInterval(function(){
autoShowSlide('HHH241', 3000);
},3000);
}
});
}
}
},3000);
function autoShowSlide(block, time) {
var slide = g_rptpage.getWidgetByName(block);
if(!slide){
return ;
}
var gocount = slide.getGocount();//步数
//var pagesize = slide.getPagesize();
//var active = slide.getActive();
//暂时只考虑一次翻一页的情况
if (gocount == 1) {
//有子页面且子页面大于1页
var slidelist = slide.slidelist;
if (slidelist != null && slidelist.getSubCount() > 1){
if (slidelist.getActiveIndex() == slidelist.getSubCount() - 1) {
//最后一页调回第一页
//slidelist.setActivePage(0);
slide.setActive(0);
} else {
//slidelist.setActivePage(slidelist.getActiveIndex() + 1);
slide.setActive(slidelist.getActiveIndex() + 1);
}
}
}
};
是自动轮换的脚本,不能使用了,是哪里错了吗?请指点一下

最佳答案
zm1997 发表于 2021-1-12 17:41
需要在那部分进行调节?
需要自己写 或定制,这边无法提供
11个回答
本帖最后由 zm1997 于 2021-1-12 16:11 编辑
xxxl 发表于 2021-1-12 16:06
您这里哪里的脚本?
是需要在报表的容器中轮播表格吗
脚本是从社区里面找的,之前测试的时候是可以用的。是需要在报表的容器中轮播表格。扩展组件可以在容器中使用的吧?
zm1997 发表于 2021-1-12 16:08
脚本是从社区里面找的,之前测试的时候是可以用的。是需要在报表的容器中轮播表格。扩展组件可以在容器中 ...

xxxl 发表于 2021-1-12 16:14
sweat.gif这个只针对表格轮播使用的脚本,其他组件需要自行修改或脚本定制
在容器中加入扩展组件,再在扩展组件中加入容器,再在容器中加入表格,这样的扩展组件的自动轮播就不可以用了吗?
zm1997 发表于 2021-1-12 16:21
在容器中加入扩展组件,再在扩展组件中加入容器,再在容器中加入表格,这样的扩展组件的自动轮播就不可以 ...
我本地试了轮播组件可以这是表样

解压后这里导入

脚本代码是
- /***
- **表格内容自动轮播脚本
- **@param tableDom内容滚动的表格,最好是表格的父DIV
- **@param visibleHeight 可视区的高度
- ***/
- function autoScrollTable(tableDom, visibleHeight) {
- var marqueesHeight = visibleHeight;
- var stopscroll = false;
- var scrollElem = tableDom;
- var freshScrollHeight = tableDom.firstElementChild.offsetHeight/4;
- 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) {
- //console.log("preTop =" + preTop);
- scrollElem.scrollTop = freshScrollHeight + 2;
- scrollElem.scrollTop += 1;
- }
- }
- setTimeout(scrollUp, 5);//控制速度 越大越慢
- };
- var restartScroll = function () {
- scrollElem.scrollTop = 0;
- setTimeout(scrollUp, 50);
- };
- jQuery(tableDom).hover(function () {
- stopscroll = true;
- }, function () {
- stopscroll = false;
- });
- //控制开始是否延迟
- setTimeout(restartScroll, 0);
- }
- /*
- *复制表格每行内容
- */
- function copyTableRows(tableDom) {
- var tBody = tableDom.firstElementChild.children[1];
- var rowList = tBody.children;
- var rowLength = rowList.length;
- for(var i=0 ; i<rowLength ; i++){
- var trow = rowList[i];
- var newTR = tBody.insertRow(rowLength+i);
- newTR.style.height = trow.style.height;
- copyRowCells(trow , newTR);
- }
- }
- /*
- *复制每行的列内容
- */
- function copyRowCells(trow , newTR) {
- var cellList = trow.children;
- var cellLength = cellList.length;
- var cellHtml = "";
- for(var i=0 ; i<cellLength ; i++){
- var cell = cellList[i];
- cellHtml += cell.outerHTML;
- }
- newTR.innerHTML = cellHtml;
- }
- //复制表格行内容
- copyTableRows(document.getElementById('GRID1'));
- autoScrollTable(document.getElementById('GRID1'),document.getElementById("HHH2").clientHeight);
- copyTableRows(document.getElementById('GRID2'));
- autoScrollTable(document.getElementById('GRID2'),document.getElementById("HHH3").clientHeight);
zm1997 发表于 2021-1-12 16:45
不好意思,我需要的不是这个效果。而是轮换组件等3-5秒后自动从第一页换到第二页的操作 ...
那就试试这个帖子https://bbs.esensoft.com/thread-132648-1-1.html
xxxl 发表于 2021-1-12 16:49
那就试试这个帖子https://bbs.esensoft.com/thread-132648-1-1.html
使用的就是这个方法,但是好像它不能自己动