fullcalendar을 통해 캘린더 응용 프로그램을 개발하고 있습니다.fullcalendar : 자신의 daycell을 가리키면 특정 날짜의 모든 일정을 표시합니다.
저는 현재 미니 크기의 캘린더를 만들고 있습니다. 미니 캘린더는 이벤트를 표시하지 않습니다.
대신 툴팁을 사용하려고합니다. 사용자가 특정 daycell을 마우스 오버 할 때 특정 daycell의 모든 이벤트가 툴팁을 통해 표시됩니다. (이것은 제 문제입니다)
저는 이틀 동안 거의이 문제를 해결하기 위해 노력하고 있습니다.
전체 캘린더는 "eventMouseover"만을 제공합니다. (daydayMouseover 가능).
또한 $ (".fc-day"). hover를 사용하면 셀 바닥을 가리킬 때만 작동하기 때문에 이동하는 것이 가장 좋은 방법은 아닙니다.
지금까지 웹에 대한 문서가 없습니다.
누가 문제를 해결할 수있는 가장 좋은 방법인지 아는 사람이 있습니까? 여기
지금까지 내 코드입니다 :$("#miniCalendar").fullCalendar({
defaultDate: currentDate,
viewRender: function (view, element)
{
monthStart = view.intervalStart.format("YYYY-MM-DD");
monthEnd = view.intervalEnd.subtract(1, "days");
monthEnd = view.intervalEnd.format("YYYY-MM-DD");
mStart = view.intervalStart.format("M");
yStart = view.intervalStart.format("YYYY");
},
events: function (start, end, timezone, callback) { //custom events function to be called every time the view changes
$.ajax({
url: getMonthDataUrl,
type: "post",
data: {
startDate: monthStart,
endDate: monthEnd,
custom_config: Config
},
error: function() {
//alert("there was an error while fetching events!");
},
success: function (data) {
calendarData = data;
console.log(calendarData);
thingsToDoAfterWeLoadCalendarData(calendarData);
callback(eventsJsonArray); //pass the event data to fullCalendar via the supplied callback function
}
});
},
fixedWeekCount: false,
dayRender:
function (date, cell) {
//the events are loaded vie eventAfterAllRender function
//eventAfterAllRender takes time to load. so we need dayRender function in order to give the calendar default colors until the real colors are loaded
// the default colors spouse to look like the correct colors. this is needed for a better looking calendar while loading new events
if (!cell.hasClass("fc-other-month")) {
//that means this is a cell of this current month (becuase only cells that belong to other month have the "fc-other-month" class
var weekDay = date.format("dddd");
if (weekDay == "Saturday" || weekDay == "Friday") {
cell.css("background-color", "#edf5f9");
} else{
//regular days
cell.css("background-color", "#f7fafc");
}
} else{
//cells that belong to the other months
$(".fc-other-month").css("background-color", "#ffffff");
}
},
eventAfterAllRender:
(function(view, event, element) {
let viewDisplay = $("#miniCalendar").fullCalendar("getView");
if (viewDisplay.name == "month") { //checking if this the month view. this is needed for better display of the week\day view (if we ever want to use it)
$(".fc-day:not(.fc-other-month)").each(function(index, element) {
//loop through each current month day cell
$(this).empty(); //removing old icons in case they are displayed
let cellDate = moment($(this).data("date")).format("YYYY-M-D"); // "YYYY-M-D" date format is the key in the json_backgrundColorBigCalendar array
$(this).css("background-color", json_backgrundColorBigCalendar[cellDate]); //set the background colour of the cell from the json_backgrundColorBigCalendar array.
});
}
$(".fc-other-month").css("background-color", "#ffffff"); //days that belong to other month gets a color background that will show this days are irrelevant
}),
dayClick: function(date, jsEvent, view) {
window.location = fullCalendarUrl;
},
});
감사합니다! 당신이 어떻게 특정 호버 한 세포의 사건을 검색 할 수 있는지 아십니까? – codingnighter2000
@ codingnighter2000 날짜가 있으면 (위의 예와 같이) fullCalendar "clientEvents"메서드를 사용하고 콜백을 전달하여 날짜를 확인하고 해당 날짜를 가져올 수 있습니다. 이 답변과 매우 유사합니다 (그러나 정확하게 같지는 않습니다) : https://stackoverflow.com/a/47175973/5947043 – ADyson
@ codingnighter2000 업데이트 된 답변보기 기본적으로 그것은 ADysons 연결된 답변에 표시된 동일합니다. –