弹出窗口中的jquery周日历 我在尝试什么

弹出窗口中的jquery周日历 我在尝试什么,jquery,popup,jquery-week-calendar,Jquery,Popup,Jquery Week Calendar,我正在尝试实现一个事件管理网站,当点击一个链接时,会出现一个弹出窗口,其中有一个日历显示事件。 我在这里使用的是jquery周日历 要求 我在这里面临的问题是,当第一次单击链接时,日历工作正常。但当我再次单击它而不刷新页面时,日历不会显示。当我检查时,它显示出错误 TypeError:options.shortDays未定义 …options.useShortDayNames?options.shortDays[date.getDay()]:options.longDays[d.. 在jquer

我正在尝试实现一个事件管理网站,当点击一个链接时,会出现一个弹出窗口,其中有一个日历显示事件。 我在这里使用的是jquery周日历

要求 我在这里面临的问题是,当第一次单击链接时,日历工作正常。但当我再次单击它而不刷新页面时,日历不会显示。当我检查时,它显示出错误

TypeError:options.shortDays未定义

…options.useShortDayNames?options.shortDays[date.getDay()]:options.longDays[d..
在jquery.weekcalendar.js(第3098行)中

我如何解决这个问题

日历仅在页面加载后第一次工作

剧本

×
功能日历POP(类别,典型){
如果(类型==1){
风险值天数=1;
}
否则如果(典型==2){
var天数=2天;
}
否则如果(典型==3){
风险值天数=7天;
}
var$calendar=$(“#calendar_popup”).weekCalendar({
时间间隔:4,
scrollToHourMillis:0,
高度:功能($calendar){
返回$(window).height()-$('h1').outerHeight(true);
},
eventRender:函数(calEvent,$event){
if(calEvent.end.getTime()
你能到这里来吗:

请将URL添加到JSON数据中,然后我们可以从那里进行调试

我还发现,外部化所有JS(包括从html中删除onclick=“”)和使用jQuery事件监听器)更易于维护

jQuery(document).ready(function($)
                       {
$('#reveal_popup').click(function()
{
  calendarpop('MT','1');
});
var calendarpop = function calendarpop(cat,typ) 
{
var days;
    if(typ == 1){
        days = 1;
    }
    else if(typ==2){
        days = 2;
    }
    else if(typ==3){
        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'
    });
}
});
jQuery(文档).ready(函数($)
{
$(“#显示弹出窗口”)。单击(函数()
{
calendarpop('MT','1');
});
var calendarpop=功能calendarpop(类别,典型)
{
var天数;
如果(类型==1){
天数=1天;
}
否则如果(典型==2){
天数=2天;
}
否则如果(典型==3){
天数=7天;
}
var$calendar=$(“#calendar_popup”).weekCalendar({
时间间隔:4,
scrollToHourMillis:0,
高度:功能($calendar){
返回$(window).height()-$('h1').outerHeight(true);
},
eventRender:函数(calEvent,$event){
if(calEvent.end.getTime()
console.log($.datepicker.dayNamesShort)提供了什么?
jQuery(document).ready(function($)
                       {
$('#reveal_popup').click(function()
{
  calendarpop('MT','1');
});
var calendarpop = function calendarpop(cat,typ) 
{
var days;
    if(typ == 1){
        days = 1;
    }
    else if(typ==2){
        days = 2;
    }
    else if(typ==3){
        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'
    });
}
});