fullcalendar取消绑定事件中可点击图标的eventClick方法 [英] fullcalendar unbind the eventClick method for the clickable icons placed on the events

查看:147
本文介绍了fullcalendar取消绑定事件中可点击图标的eventClick方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fullcalendar插件。我曾使用jquery .on()函数使图标可点击,但问题是当我点击放置在事件上的图标时,fullcalendar插件的eventClick方法也会触发。我不希望eventClick方法被触发,当我点击放置在fullcalendar月视图上的事件上的图标时。有人遇到类似的问题吗?无论如何,只有在点击事件上的图标时才能禁用eventClick方法。我尝试使用.unbind()函数,但evenClick方法与用于使图标可点击的.on()函数一起被触发。 解决方案方案

在最终的图标点击事件中,您可以取消该事件向DoomTree的传播。


$ b 示例: http://api.jquery.com/event.stopImmediatePropagation/


$ b (click,function(event){
event.stopImmediatePropagation();
}); $ b

  $(。icons)。 

或者: http://api.jquery.com/event.stopPropagation/

  $ (.icons)。on(click,function(event){
event.stopPropagation();
//做某事
});


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.

解决方案

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
});

这篇关于fullcalendar取消绑定事件中可点击图标的eventClick方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆