活动日期的完整日历警报

发布于 2024-12-06 10:19:43 字数 691 浏览 1 评论 0原文

我的问题是: 当今天的日期是 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',
       }
    });
}

其中 birthday 是个人的生日(我将其设置为 var),而 today 显然是今天的日期。 我遇到的问题是,这不是很有活力,因为我必须为每个人单独执行此操作。

非常感谢。

my question is:
Is it possible to trigger something (ie. alert, Qtip, whatever) when today's date is the date of an event in the FullCalendar? I am using the XML from my Google calendar as the source and would like something to pop up for people's birthdays.

I already have:

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',
       }
    });
}

Where birthday is the individuals birthdate (which I set as a var) and today is ,obviously, today's date.
The problem I have is that this is not very dynamic as I will have to do this seperately for everyone.

Many thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぽ尐不点ル 2024-12-13 10:19:43

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

                }
            });
        });

When you create your calendar object/function you need to create a eventAfterRender function. This only fires when you have a function that has been placed on the calendar. Then you can read the date and compare it to ones birthday and display popup. I hope that is what your were looking for. I gave a little example.

    $(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 

                }
            });
        });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文