问题
I am using fullcalendar plugin. I had used the jquery .on() function to make the icons clickable but the issue is when I click on the icons that are placed on the events then the eventClick method of the fullcalendar plugin is also triggerd. I dont want the eventClick method to be triggered when I click on the icons that are placed on the events on the fullcalendar month view. Has someone faced the similar issue? Is there anyway to disable the eventClick method only when the icons on the events are clicked. I tried to use the .unbind() function but still the evenClick method is been triggered along with the .on() function used for making the icons clickable.
回答1:
In click event of your icons in the end you can cancel the propagation of tha event to the DoomTree.
Example: http://api.jquery.com/event.stopImmediatePropagation/
$(".icons").on("click", function(event){
event.stopImmediatePropagation();
});
Or: http://api.jquery.com/event.stopPropagation/
$(".icons").on("click", function(event){
event.stopPropagation();
// do something
});
来源:https://stackoverflow.com/questions/12002468/fullcalendar-unbind-the-eventclick-method-for-the-clickable-icons-placed-on-the