我正在尝试什么
我正在尝试实现一个事件管理站点,在该站点中,单击链接时会出现一个弹出窗口,其中包含显示事件的日历。我在这里使用jquery 周历。
要求
我在这里面临的问题是,第一次单击链接时日历工作正常。但是,当我再次单击它而不刷新页面时,日历不会显示。当我检查它显示错误
TypeError: options.shortDays is undefined
...options.useShortDayNames ? options.shortDays[date.getDay()] : options.longDays[d...
在jquery.weekcalendar.js (line 3098)
.
我该如何解决这个问题?
日历仅在页面加载后第一次工作。
脚本
<a href="#" data-reveal-id="reveal_popup" onclick="calendarpop('MT','1');" data-closeonbackgroundclick="false" data-dismissmodalclass="close-reveal-modal">due_today</a>
<div id="reveal_popup" class="reveal-modal">
<div id="calendar_popup"></div>
<a class="close-reveal-modal">×</a>
</div>
function calendarpop(cat,typ) {
if(typ == 1){
var days = 1;
}
else if(typ==2){
var days = 2;
}
else if(typ==3){
var days = 7;
}
var $calendar = $('#calendar_popup').weekCalendar({
timeslotsPerHour: 4,
scrollToHourMillis : 0,
height: function($calendar){
return $(window).height() - $('h1').outerHeight(true);
},
eventRender : function(calEvent, $event) {
if (calEvent.end.getTime() < new Date().getTime()) {
$event.css('backgroundColor', '#aaa');
$event.find('.wc-time').css({
backgroundColor: '#999',
border:'1px solid #888'
});
}
},
data : function(start, end, callback) {
$.getJSON(
site_url()+'/event/eventpop/'+cat+'/'+typ,
'',
function(result) {
callback(result);
}
);
},
allowCalEventOverlap : true,
overlapEventsSeparate: true,
showAsSeparateUser: false,
displayOddEven: true,
displayFreeBusys: true,
daysToShow: days,
buttons: false,
headerSeparator: ' ',
useShortDayNames: true,
firstDayOfWeek: $.datepicker.firstDay,
shortDays: $.datepicker.dayNamesShort,
longDays: $.datepicker.dayNames,
shortMonths: $.datepicker.monthNamesShort,
longMonths: $.datepicker.monthNames,
businessHours :{
start: 6,
end: 22,
limitDisplay: true
},
dateFormat: 'd F Y'
});
}