2017-02-11 6 views
0

私はfullcalendarスケジューラが人がクリックする領域にスクロールするようにしようとしていますが、このコードは多少は機能しますが、画面サイズによっては、過去にスクロールされ、ウィンドウ内では表示されません。divを表示するためのスクロール

テーブルヘッダーセルの左端がウィンドウの左端に揃うようにする方法はありますか?ビューで

は、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); 
}; 

答えて

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); 
}; 
関連する問題