fullcalendar事件单击事件中的vs链接 [英] fullcalendar event click vs link inside the event

查看:175
本文介绍了fullcalendar事件单击事件中的vs链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。也许这是不可能的,但我希望澄清。 Fullcalendar现在有这样的事情,如果在事件中有一个url,整个事件是可点击的,只是把你带到那个特定的url。
在我的情况下,我需要在事件中有必须有可点击的链接。
请参阅小提琴



请让我知道,如果有办法禁用该事件点击自己,但只保留链接的点击可用。我知道有一种方法来禁用这样的事件:

  eventClick:function(event){
return假;
}

但是,这将禁用所有甚至事件中的链接。最终所有的事件将通过ajax或其他方式从数据库中拉出来填充日历。所以请记住,我将需要以某种方式提供一个URL来接收事件。

解决方案

你有没有从fullcalendar docs 尝试示例?



fullCalendar({
events:[{
title:'我的活动',
开始:'2017)

  $ -01-13',
url:'http://google.com/'
}],
eventClick:function(event){
if(event.url) {
//如果要在同一个标​​签中打开网址
location.href =https://example.com;
//如果要在另一个窗口中打开网址/ tab,使用下面的注释代码
//window.open(event.url);
return false;
}
}
});

我不知道如何在你的活动中呈现链接,但这应该是你做的



最好的问候
Krzysztof


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.

解决方案

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

这篇关于fullcalendar事件单击事件中的vs链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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