gpt4 book ai didi

javascript - 在月 View 或年 View 中单击事件时显示事件的日 View

转载 作者:行者123 更新时间:2023-11-29 10:44:52 25 4
gpt4 key购买 nike

我不熟悉使用完整日历,想知道是否可以显示已单击事件的日 View (特别是日期)。如果在“年”或“月” View 中单击该事件,则需要执行此操作。

我还想知道的另一件事是,当在日 View 中单击事件时,是否可以显示灯箱(显示在所有其他内容上方的 div)。

我已经对这些问题进行了 2 天的研究,尽管我发现了 -

dayClick: function(date, allDay, jsEvent, view) {
$('#calendar').fullCalendar('gotoDate', date);
},

我无法调整或更改它以正确处理该事件。

如有任何建议,我们将不胜感激。

先谢谢你,克里斯

最佳答案

这应该让你继续:

// Added Coded whilst trying to fix onEventClick       
eventClick: function(calEvent, jsEvent, view) {
jsEvent.preventDefault();

// Go to and show day view for start date of clicked event
calendar.fullCalendar('gotoDate', calEvent.start);
calendar.fullCalendar('changeView', "basicDay");

// Popup with information of clicked event
if(calEvent.url) {
$("#eventDisplay").html("<p><b>Title:</b> <a target='_blank' href='" + calEvent.url + "'>" + calEvent.title + "</a></p>");
} else {
$("#eventDisplay").html("<p><b>Title:</b> " + calEvent.title + "</p>");
}
$("#eventDisplay").append("<p><b>Start:</b> " + calEvent.start + "</p>");
$("#eventDisplay").dialog({
width: 400,
modal: true
});
},
// End Code onEventClick

Fidle 显示两个请求:显示日 View 并弹出带有事件信息的 jQuery UI 对话框。

请注意,对于触发外部 URL 的事件,您应该首先使用 .preventDefault。您当然可以在弹出式 HTML 中提供链接,让用户点击它(如果他真的想这样做)。请参阅 2 月 28 日事件的示例。

关于javascript - 在月 View 或年 View 中单击事件时显示事件的日 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21676839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com