jQuery 在 FullCalendar 中隐藏开始时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2732132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 14:11:09  来源:igfitidea点击:

Hide start time in FullCalendar

jqueryfullcalendar

提问by Theo

On FullCalendar, in the month view, is there a way to hide an event's start time?

在 FullCalendar 的月视图中,是否可以隐藏事件的开始时间?

回答by andrey

Just add to calendar options

只需添加到日历选项

displayEventTime: false

回答by Riz

add the following style to your css

将以下样式添加到您的 css 中

.fc-event-time{
   display : none;
}

or in version 2+:

或在版本 2+ 中:

.fc-time{
   display : none;
}

回答by Raymond

Try this, it works for me:

试试这个,它对我有用:

$('#calendar').fullCalendar({
     displayEventTime : false
});

That should hide the start time in the title event.

这应该隐藏标题事件中的开始时间。

回答by Jayanti Gopaloodoo

The following hides the date on the month view only:

以下仅隐藏月视图中的日期:

.fc-view-month .fc-event-time{
    display : none;
}

回答by Thiago A

To hide them all, the following should work

要将它们全部隐藏,以下应该有效

$('#calendar').fullCalendar({
 displayEventTime : false
});   

But if you (like me) were trying to hide the time of a specific event, I found pretty clean way.

但是如果你(像我一样)试图隐藏特定事件的时间,我找到了非常干净的方法。

Just create the following CSS class and refer to it in the event property "className":

只需创建以下 CSS 类并在事件属性“className”中引用它:

.hideCalendarTime > div > span.fc-time{
    display:none;
}

And your event should look something like this:

您的活动应如下所示:

var newEvent = new Object();
newEvent.title = "Something";
newEvent.start = new Date();
newEvent.allDay = false;
newEvent.className = "hideCalendarTime";

回答by Catfish

Another way is to add an eventRender function. This way you can choose to not render the time, and do something else like append some data to the event.

另一种方法是添加一个 eventRender 函数。通过这种方式,您可以选择不渲染时间,并执行其他操作,例如将一些数据附加到事件中。

eventRender: function(event, element) { 
    element.find('.fc-event-title').append("<br/>" + event.location); 
    element.find('.fc-event-time').hide();
}

回答by AJ Hsu

remind that the CSS class name has changed to

提醒 CSS 类名称已更改为

.fc-time {
    display:none;
}

回答by Gouli Mahesh

In case you completely want to remove the Start time, you can use the below code

如果您完全想删除开始时间,可以使用以下代码

$('#calendar-canvas').fullCalendar({
    header: {
        left: 'today prev,next title',
        right: 'agendaDay,agendaWeek,month'
    },
    firstDay: 1,
    eventRender: function(event, element) {
        $(element).find(".fc-event-time").remove();
    }
});

回答by Artem Pogorelov

According to http://fullcalendar.io/docs/text/timeFormat/, you just need to set time format in fullCalendar settings:

根据http://fullcalendar.io/docs/text/timeFormat/,您只需要在 fullCalendar 设置中设置时间格式:

$('#calendar').fullCalendar({
    events: [              
    ],
    timeFormat: ' '
});

回答by Bill

I know it has been three months since you asked the question. But, if you and I are trying to do the same thing than someone else may be looking for the answer.

我知道你问这个问题已经三个月了。但是,如果你和我正在尝试做同样的事情,那么其他人可能正在寻找答案。

In the fullcalendar.js file, comment line 1603:

在 fullcalendar.js 文件中,注释第 1603 行:

htmlEscape(formatDates(event.start, event.end, view.option('timeFormat'), options)) +

This is not a fix, at best it is a hack, but it works.

这不是修复,充其量只是一个黑客,但它有效。