gpt4 book ai didi

javascript - fullCalendar dayClick 转到被单击的日期

转载 作者:行者123 更新时间:2023-11-29 18:12:47 25 4
gpt4 key购买 nike

有没有办法转到点击日期的agandaDay。下面的代码是我目前拥有的代码,但它不起作用。

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

它的作用是转到当前日期(今天)或上次手动访问的日期。我还需要做什么才能转到点击的日期/日期的议程日?

最佳答案

FullCalendar(我想从 2.0 开始)使用 momentjs 库来处理日期

在传递给 fullcalendar 之前,必须预先计算日期:

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

详细说明:

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

打开控制台并逐行放置这些行(我认为这是问题所在):

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

你得到了这个结果(图片)

enter image description here

级联的原因:

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

不工作是从 changeView 返回 valur 不返回任何对象

enter image description here

关于javascript - fullCalendar dayClick 转到被单击的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25807222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com