0

我正在尝试使全日历调度程序滚动到人们单击的区域,并且此代码有些作用,但是根据屏幕大小,它应该缩放到的实际区域通常会滚动过去,并且在其中不可见窗户。

有没有办法确保表格标题单元格的左边框与窗口的左边框对齐?

在视图中, div 内有一个水平滚动表$('.fc-time-area.fc-widget-header .fc-scroller'),我希望可见的单元格可以通过以下方式找到:$(".fc-time-area.fc-widget-header .fc-content th[data-date='2017-2-11T10:00:00']")

var centerTime = function (day) {
    $('.fc-time-area.fc-widget-header .fc-scroller').animate({
        scrollLeft: $(".fc-time-area.fc-widget-header .fc-content").find("th[data-date='" + day + "']").offset().left
    }, 750);
};
4

1 回答 1

0

我想到了。offset()显然使用和之间存在差异position()。通过改变这个简单的事情,它现在工作得很好。

var centerTime = function (day) {
    $('.fc-time-area.fc-widget-header .fc-scroller').animate({
        scrollLeft: $(".fc-time-area.fc-widget-header .fc-content").find("th[data-date='" + day + "']").offset().left
    }, 750);
};
于 2017-02-11T15:10:34.450 回答