FullCalendar switch between weekends and no weekends

后端 未结 7 1400
天命终不由人
天命终不由人 2021-01-14 15:48

I was wondering if there was a way in Arshaw\'s FullCalendar to: 1- Change the calendar from showing weekends to not show weekends and vice versa. 2- To dynamically change t

7条回答
  •  遥遥无期
    2021-01-14 16:41

    try this:

    $('#values').click(function(){
        var weekend = $('#calendar').fullCalendar('option', 'weekends');
        if (weekend){
            $('#values').text('Show weekend');
            $('.fc-header').remove();
            $('.fc-content').remove();
            $('#calendar').fullCalendar({ firstDay:1, height:650, 
                                               weekMode:'liquid', weekends:false, 
                                               header: {left: 'prev,next today', 
                                                        center: 'title',
                                                        right: 'month,
                                                        agendaWeek,agendaDay'}});
        } else {
            $('#values').text('Hide weekend');
            $('.fc-header').remove();
            $('.fc-content').remove();
            $('#calendar').fullCalendar({ firstDay:1, height:650, 
                                   weekMode:'liquid', weekends:true, 
                                   header: {left: 'prev,next today',
                                            center: 'title',
                                             right: 'month,agendaWeek,agendaDay'}});
        };
    });
    

提交回复
热议问题