繁体   English   中英

活动日期的全日历提醒

[英]FullCalendar alert on event date

我的问题是:当今天的日期是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),而今天显然是今天的日期。 我的问题是这不是很动态,因为我将不得不为每个人分别进行此操作。

提前谢谢了。

创建日历对象/函数时,需要创建一个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 

                }
            });
        });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM