javascript - Scrolling to make div visible -
i trying make fullcalendar scheduler scrolls area person clicks on, , code works somewhat, depending on screen size, actual area should zoom scrolled past, , not visible within window.
is there way ensure table header cell's left border aligned window's left border?
in view, there horizontal scrolling table inside div $('.fc-time-area.fc-widget-header .fc-scroller')
, , cell want visible can found this: $(".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); };
i figured out. apparently there difference between using offset()
, position()
. changing simple thing, works great now.
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); };
Comments
Post a Comment