FullCalendar switch between weekends and no weekends

后端 未结 7 1392
天命终不由人
天命终不由人 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:42

    Hope below code snippet might help you (I am using fullcalendar.js version 2)

    var calendarInitiate = function(noWeekend){
    $("#calendar").fullCalendar('destroy');
    $("#calendar").fullCalendar({weekends:noWeekend, events: [{ ...enter events list here... }]});
    }
    calendarInitiate(true); //True initially to show weekends
    
    $("#showWeekends").click(function(){ calendarInitiate(true); //This will show weekends });
    $("#hideWeekends").click(function(){ calendarInitiate(false); //This will hide weekends });
    

提交回复
热议问题