问题
I have a question. Maybe this is not possible but I was hoping for clarification. Fullcalendar right now has it so if there is a url inside the event, the whole event is clickable and just takes you to that particular url. In my case I need to have a link inside the event that has to be clickable. See Fiddle
Please let me know if there is a way to disable the event click itself but only keep the click of the link available. I know that there is a way to disable an event like this:
eventClick: function(event) {
return false;
}
However, this will disable everything even the link inside the event. Eventually all of the events will be pulled via ajax or some other way from DB to populate the calendar. So keep in mind that I will need to provide a URL in some way for the event to pick it up.
回答1:
Did you try the example from fullcalendar docs?
$('#calendar').fullCalendar({
events: [{
title: 'My Event',
start: '2017-01-13',
url: 'http://google.com/'
}],
eventClick: function(event) {
if (event.url) {
//if you want to open url in the same tab
location.href = "https://example.com";
//if you want to open url in another window / tab, use the commented code below
//window.open(event.url);
return false;
}
}
});
I don't know how do you render the link in your events, but this should do what you need.
Best regards
Krzysztof
来源:https://stackoverflow.com/questions/41616271/fullcalendar-event-click-vs-link-inside-the-event