最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - fullCalendar dayClick go to the day that is clicked - Stack Overflow

programmeradmin5浏览0评论

is there a way to go to the agandaDay of the clicked day. The code below is what I have so far but it's not working.

dayClick: function(date, allDay, jsEvent, view) {
  $('#calendar').fullCalendar('changeView', 'agendaDay')
                    .fullCalendar('gotoDate', date);
  }

What this does it goes to either the current date (today) or to the last manually accessed date. What else do I need to do to make go to the agendaDay of the clicked day/date?

is there a way to go to the agandaDay of the clicked day. The code below is what I have so far but it's not working.

dayClick: function(date, allDay, jsEvent, view) {
  $('#calendar').fullCalendar('changeView', 'agendaDay')
                    .fullCalendar('gotoDate', date);
  }

What this does it goes to either the current date (today) or to the last manually accessed date. What else do I need to do to make go to the agendaDay of the clicked day/date?

Share Improve this question asked Sep 12, 2014 at 11:26 Richard TonataRichard Tonata 3631 gold badge6 silver badges14 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

FullCalendar (I think from 2.0) uses momentjs library to deal with dates

date must be calculated previously, before passing to fullcalendar:

var date = $.fullCalendar.moment('2014-05-01');

Detailed instructions:

Goto http://fullcalendar.io/js/fullcalendar-2.1.1/demos/basic-views.html

Open console and put these lines, line by line (I think this is the issue):

var date = $.fullCalendar.moment('2014-05-01');
$('#calendar').fullCalendar('changeView', 'agendaDay');
$('#calendar').fullCalendar('gotoDate',date);

You got this result (image)

The reason that cascade:

 $('#calendar').fullCalendar('changeView', 'agendaDay').fullCalendar('gotoDate',date);

does not work is that returning valur from changeView is not return any object

Late to the answer, but just ran into this myself and thought this fiddle would be helpful: http://jsfiddle/88n10j7f/

dayClick: function(date, jsEvent, view) {
  $('.calendar').fullCalendar('changeView', 'agendaDay')
  $('.calendar').fullCalendar('gotoDate', date);
}
发布评论

评论列表(0)

  1. 暂无评论