I have a fullcalendar defaults to week view. Current day is highlighted. There is another external event div from where an event need to drop on the calendar. This things works as designed. There is also a custom button clicking on which event should be added on the calendar. By default it drops on current date. But when user changes week, navigate to next or previous week, no day is selected.
I want to not only select every 7th day (+7 for next or -7 for previous) to be default day and change its color.
Difficult to provide full code, but here it, run the following link and set the view to week view. When you open week view, Friday 26th is current day and selected. When user navigate to Prev or next, I want to 2nd Nov or 19th Oct be the default day and be highlighted (color)
https://fullcalendar.io/docs/external-dragging-demo
I have tried few things without any success:
$('.fc-prev-button').click(function(){
//currCalDate is global variable to store the current day
currCalDate.setDate(currCalDate.getDate() - 7);
console.log(currCalDate);
$('#calendar').fullCalendar('gotoDate', currCalDate);
});
$('.fc-next-button').click(function(){
currCalDate.setDate(currCalDate.getDate() + 7);
$('#calendar').fullCalendar('gotoDate', currCalDate);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Then tried using dayRender in FC definition or may be something can be done with viewRender?
dayRender: function (date, cell) {
var today = new Date(currCalDate);
date = moment(date).toDate();
if (date.getDate() === today.getDate()) {
cell.css("background-color", "red");
}
},