我正在使用Fullcalendar for jQuery,由於某種原因,日曆在頁面上出現兩次。這不是關於在同一頁面上有兩個fullcalendar實例的問題。Fullcalendar:爲什麼日曆在頁面上出現兩次?
相反,在第一個日曆的底部,有第二個相同的日曆。
我確認在我的頁面中只有一個#calendar div,所以這個錯誤與我的.js有關,我調用fullcalendar.js,我相信。
任何幫助非常感謝。
JS代碼:
jQuery('#calendar').fullCalendar({
year: jQuery.today.getFullYear(),
month: jQuery.today.getMonth(),
date: jQuery.today.getDate(),
theme: true,
contentHeight: 1000,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaDay',
dayClick: function(date, allDay, jsEvent, view) {
// a lot of custom code
}
});
HTML:
<table><tr><td valign="top" width="700px"><div id="calendar"></div></td></tr></table>
其他fullcalendar的javascript調用(這會一個datepicker在DIV到左同一頁上#calendar的div):
jQuery('#datepicker_for_calendar').datepicker({
defaultDate: jQuery.today,
minDate: jQuery.startDate,
maxDate: jQuery.endDate,
inline: true,
showButtonPanel: true,
onSelect: function(dateText, inst) {
var d = new Date(dateText);
jQuery('#calendar').fullCalendar('gotoDate', d);
selectedDate = d;
}
});
請問您可以發佈相關的HTML和JavaScript? – Brandon 2011-03-10 19:20:17
我在fullcalendar調用中有相當多的代碼,希望會有一個通用的原因。將盡力減少問題的代碼。 – netefficacy 2011-03-10 19:26:18
「相當多的代碼」很可能是問題的一部分。另外,你還有其他'fullCalendar'調用(使用字符串參數進行操作)? – justkt 2011-03-10 19:38:56