Search code examples
javascriptjqueryruby-on-railsfullcalendar

Making fullcalendar scroll to the current time?


Simply put, is there a way to have fullcalendar scroll to the current time position in the week view?

If it helps, I'm using Ruby on Rails and jQuery


Solution

  • Do you mean that you want the calendar to display, automatically centered around the current time of day (of render time)?

    Assuming that you are happy that the day columns are always in the same place there is the firstHour option in the agendaWeek view which might work for you.

    For illustration, let's assume that the number of hours on the Y-axix in your given view is 10 then something like:

    var firstHour = new Date().getUTCHours() - 5;
    $('#calendar').fullCalendar({
      firstHour: firstHour;
    });
    

    More details on view controls are available here