2017-08-24 105 views
0

我已查看使用fullcalendar插件的位置。僅在今天全日曆顯示

這裏是查看代碼:

<div id="calendar" style="height: 90%; width: 100%; clear: both; display: inline-block;overflow-y:hidden "> 

    </div> 

<script> //Calendar initialization 
$(document).ready(function() { 
    $('#calendar').fullCalendar({ 
     header: { 
      left: 'prev,next', 
      center: 'title', 
      right: 'month,agendaWeek,agendaDay' 
     }, 
     defaultView: 'agendaWeek', 
     events:"/Calendar/GetEvents/", 
     firstDay: 1, 
     editable: true 
    }); 
}); 

但另一種觀點認爲我需要證明纔有了今天的日期。喜歡這裏的設計

enter image description here

我怎麼能在fullcalendar做到這一點?

+0

只是內部的div創建第二個日曆對象,所有的設置相同,但它僅允許agendaDay視圖,默認日期是今天,並且沒有按鈕來改變的一天。 – ADyson

回答

0

您可以在單獨的對象中設置日曆設置並使用函數重新創建FC視圖。

var $fc = $("#calendar"); 

var options = { // Create an options object 
    header: { 
    left: 'prev,next today', 
    center: 'title', 
    right: 'agendaDay,agendaWeek,month' 
    }, 
    defaultView: 'agendaWeek', 
    events:"/Calendar/GetEvents/", 
    firstDay: 1, 
    editable: true 
} 

$fc.fullCalendar(options); 

function recreateFC(/*arguments*/) { // This will destroy and recreate the calendar 

    if (/*your condition here*/) { 
    options.defaultView = 'agendaDay'; 
    } else { 
    options.defaultView = 'agendaWeek'; 
    } 
} 
相關問題