fullcalendar中的Dayclick无法在我的yii2网站上运行。我使用了以下代码。我无法使这段代码正常工作。
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
ignoreTimezone:true,
editable: true,
events: $list,
className: 'gcal-event',
eventClick:function(event){
var x = event.id;
document.cookie='id='+x+'';
$('#cal-modal').modal('show');
}
});
$('#calendar').fullCalendar({
dayClick: function(date, jsEvent, view) {
alert('Clicked on: ' + date.format());
$(this).css('background-color', 'red');
}
});
});
请查看我的代码并提出建议。
答案 0 :(得分:0)
请检查:https://fullcalendar.io/docs/mouse/dayClick/
$('#calendar').fullCalendar({
dayClick: function(date, allDay, jsEvent, view) {
if (allDay) {
alert('Clicked on the entire day: ' + date);
}else{
alert('Clicked on the slot: ' + date);
}
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert('Current view: ' + view.name);
// change the day's background color just for fun
$(this).css('background-color', 'red');
}
});