jquery - FullCalendar 在周末和无周末之间切换

标签 jquery fullcalendar

我想知道 Arshaw 的 FullCalendar 是否有办法: 1- 将日历从显示周末更改为不显示周末,反之亦然。 2- 动态更改时隙间隔,从 30 分钟更改为 60 分钟。

换句话说,我想做的是:

//Clicking the button that shows Saturday and Sunday too
    $('#weekend-yes').click(function(){
        $('#weekend-yes').hide();
        $('#weekend-no').fadeIn();
            //HYPOTHETICALLY  DO THIS
        $('#calendar').fullCalendar('option', 'weekends', true/false);
    });

如果类似的事情不可能实现,那么最好的解决方法是什么?我想我可以有第二个日历,它是第一个日历的复制品,但复制太多了。

感谢我能得到的任何帮助..

最佳答案

试试这个:

$('#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'}});
    };
});

关于jquery - FullCalendar 在周末和无周末之间切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11958479/

相关文章:

jQuery-Facebox - 从 AJAX 重新绘制后弹出窗口不起作用

javascript - 无需单击或 Ctrl 单击即可同时拖动多个 DIV

javascript - 单击自定义按钮时事件的全日历执行顺序

javascript - onmouseover 事件显示和隐藏侧边菜单的滚动条

jquery - jScrollPane:边距问题

javascript - jQuery 片段在我的 wordpress 主题中不起作用

jquery - 通过添加和删除多个事件源来过滤事件

mysql - 是否有教程解释如何动态地向 fullcalendar 添加/编辑/删除事件

javascript - jQuery 以编程方式选择值 - 奇怪的问题

javascript - 如何复制拖放事件?