Showing day view of event on event click within an month or year view
I am new to using full calendar and was wondering if it is possible to show the day view (specifically the date of) the event which has been clicked on. This would need to take place if the event is clicked in the Year or month view.
Another thing that I would also like to know if possible can a lightbox (div that is shown above everything else) be shown when an event is clicked in the day view.
I have put in 2 days research in to these problems and although i have found -
dayClick: function(date, allDay, jsEvent, view) {
$('#calendar').fullCalendar('gotoDate', date);
},
I have not been able to adapt or change this to work correctly with the event.
Any advice would be much appreciated.
Thank you in-advance, Chris
This should get you going:
// 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 to show both requests: show a day view and popup jQuery UI dialog with event information in it.
Note that for events that fire external URLs, you should first .preventDefault. You may of course offer the link in the popup HTML to have the user click it if he really wants to do so. See example for Februray 28th event.
链接地址: http://www.djcxy.com/p/81160.html