Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 滚动以使div可见_Javascript_Jquery_Fullcalendar_Fullcalendar Scheduler - Fatal编程技术网

Javascript 滚动以使div可见

Javascript 滚动以使div可见,javascript,jquery,fullcalendar,fullcalendar-scheduler,Javascript,Jquery,Fullcalendar,Fullcalendar Scheduler,我试图使fullcalendar调度程序滚动到用户单击的区域,这段代码在某种程度上起作用,但根据屏幕大小,它应该缩放到的实际区域通常会滚动过去,并且在窗口中不可见 有没有办法确保表头单元格的左边框与窗口的左边框对齐 在视图中,在div$('.fc-time-area.fc-widget-header.fc scroller')中有一个水平滚动表,可以找到我想要可见的单元格,如下所示:$(“.fc-time-area.fc-widget-header.fc content th[data date

我试图使fullcalendar调度程序滚动到用户单击的区域,这段代码在某种程度上起作用,但根据屏幕大小,它应该缩放到的实际区域通常会滚动过去,并且在窗口中不可见

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

在视图中,在div
$('.fc-time-area.fc-widget-header.fc scroller')
中有一个水平滚动表,可以找到我想要可见的单元格,如下所示:
$(“.fc-time-area.fc-widget-header.fc content th[data date='2017-2-11T10:00'])


我想出来了。显然,使用
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);
};
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);
};