我尝试过这样的事情
viewRender: function(currentView){
$('body').remove('.fc-prev-button');
$('body').remove('.fc-next-button');
$('body').remove('.fc-today-button');
}
});
但它不会删除这些按钮。我究竟做错了什么?在fullcalendar配置中执行此操作的正确方法是什么?
答案 0 :(得分:2)
答案 1 :(得分:0)
在初始化日历时,从标题的prev
,next
或today
删除left
,center
和/或right
。没有prev
,next
和/或today
的标头示例:
$('#calendar').fullCalendar({
header: { // layout header
left: '',
center: '',
right: 'month,agendaWeek,listWeek'
},
views: { // set the view button names
listWeek: {buttonText: 'list week'}
}
});
答案 2 :(得分:0)
这里有几行代码可以隐藏“上一个,下一个和今天”按钮,还可以隐藏“月”视图,还可以在“移动”视图(我设置为小于400像素宽度)的日历中隐藏“星期六”和“星期日”: >
var calendarEl = document.getElementById('calendar');
var headerJSON = {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,dayGridWeek,listWeek' // view buttons on large screens
};
var hiddenDaysArray = [];
if($(window).width() < 400)
{
headerJSON = {
left: '', // hide prev,next today in mobile view
center: 'title',
right: 'dayGridWeek listWeek' // hide dayGridMonth on small view
};
hiddenDaysArray = [0,6]; // hide sunday,saturday on small view
}
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
header: headerJSON,
hiddenDays: hiddenDaysArray, // hide Sundays and Saturdays on mobile
...