Skip to content

Commit

Permalink
表格轮播实现由滚动条方式改为顶部负间距的方式,避免出现影响整个网页滚动条的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
datageartech committed Oct 7, 2020
1 parent adecc4e commit ed29a0f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4252,12 +4252,13 @@

chartSupport.tableHandleCarousel = function(chart, initOptions, chartEle, dataTable, scrollBody, scrollTable)
{
var status = chartEle.data("tableCarouselStatus");

if(status == "stop")
if(chartEle.data("tableCarouselStatus") == "stop")
return;

var scrollTop = scrollBody.scrollTop();
//不采用设置滚动高度的方式(scrollBody.scrollTop()),因为会出现影响整个页面滚动高度的情况
var scrollTop = scrollTable.css("margin-top");
scrollTop = (scrollTop.indexOf("px") == scrollTop.length - 2 ? scrollTop.substring(0, scrollTop.length - 2) : scrollTop);
scrollTop = (Math.abs(parseInt(scrollTop)) || 0);

var currentRow = null;
var currentRowHeight = null;
Expand Down Expand Up @@ -4317,7 +4318,7 @@
var span = ($.isFunction(initOptions.carousel.span) ?
initOptions.carousel.span(currentRow, currentRowVisibleHeight, currentRowHeight) : initOptions.carousel.span);

scrollBody.scrollTop(scrollTop + span);
scrollTable.css("margin-top", (0 - (scrollTop + span))+"px");

if(addRowDatas.length > 0)
dataTable.rows.add(addRowDatas).draw();
Expand Down

0 comments on commit ed29a0f

Please sign in to comment.