事件日期的FullCalendar警报

时间:2011-09-26 13:32:44

标签: javascript fullcalendar qtip

我的问题是: 当今天的日期是FullCalendar中的事件日期时,是否有可能触发某些事情(即警报,Qtip等等)?我使用我的Google日历中的XML作为源,并希望能够为人们的生日提供一些内容。

我已经拥有:

var difference = birthdate - today;
var days = Math.round(difference/(1000*60*60*24));

if (days == 0){
    $('#tabs').qtip({
    position: {
               my: 'bottom right',
               at: 'top left',
    },
    content: "It's someone's birthday!!!",
    show: {
       when: false,
       ready: true
    },
    hide: false,
    style: {
        classes: 'ui-tooltip-rounded',
       }
    });
}

生日是个人生日(我设为var),今天显然是今天的日期。 我遇到的问题是,这不是很有活力,因为我必须单独为每个人这样做。

非常感谢提前。

1 个答案:

答案 0 :(得分:3)

创建日历对象/功能时,需要创建eventAfterRender功能。仅当您具有放置在日历上的功能时才会触发此操作。然后,您可以阅读日期并将其与生日和显示弹出窗口进行比较。我希望这就是你所寻找的。我举了一个例子。

    $(document).ready(function () {
            $('#calendar').fullCalendar({
                height: 600,
                width: 700,
                header: {
                    right: 'prev,next today',
                    center: 'title',
                    left: 'month,agendaWeek,agendaDay'
                },
                eventAfterRender: function (event, element, view) {
                    birthday = new Date('<somedate>');
                    year = new Date(event.start).getFullYear();
                    month = new Date(event.start).getMonth();
                    day = new Date(event.start).getDate();
                    alert(year + ' ' + month + ' ' + day);
    //do some if statement to see if the year matches then if the month, then the day. 
//if so then go to another function or just put the code here for the pop 

                }
            });
        });
相关问题