我正在使用完整的日历显示我的事件,此刻我在显示上周和当前一周时具有默认视图,但是我希望用户显示以显示此信息日历中的一周和下周下面我附上了代码。
<script>
$(document).ready(function () {
var calendar = $('#calendar').fullCalendar({
views: {
agendaWeek: {
type: 'agenda',
duration: {weeks: 3},
rows: 2
}
},
header: {
left: '',
center: 'title',
right: 'agendaWeek'
},
navLinks: true, // can click day/week names to navigate views
editable: true,
defaultView: 'agendaWeek',
minTime: '13:00:00', /* calendar start Timing */
maxTime: '24:00:00', /* calendar end Timing */
eventLimit: true,
events: "load_Emp_Roster.php",
displayEventTime: true,
eventRender: function (event, element, view) {
if (event.allDay === 'true') {
event.allDay = true;
} else {
event.allDay = false;
}
},
selectable: true,
selectHelper: true,
select: function (start, end, allDay) {
calendar.fullCalendar('unselect');
},
});
});
function displayMessage(message) {
$(".response").html("<div align='center' style='padding:20px;font-size:18px;color:#3539EA' class='success'>"+message+"</div>");
setInterval(function() { $(".success").fadeOut(); }, 2000);
}
</script>
根本没有任何帮助将不胜感激。
看一下https://fullcalendar.io/docs/visiblerange
我会添加类似的东西(请注意,我还没有测试过):
visibleRange: function(currentDate) {
return {
start: currentDate.clone(),
end: currentDate.clone().add(2, 'weeks')
};
}