我想使用 JQuery fullcalendar 插件(版本 1.5.2)显示事件。提供给这个插件的 JSON 数据是:
[{"start":"2011-10-10","end":"2011-10-11","title":"Electric Picnic","allDay":true},
{"start":"2011-10-10","end":"2011-10-11","title":"Oxeygen","allDay":true}]
我已将 allDay 设置为 true,但当显示事件时,它们看起来像是在 2011 年 10 月 10 日早上 6 点左右开始的。
我也尝试过使用 UNIX 时间戳日期格式,但没有任何区别。我怎样才能让这些事件看起来好像持续了整整两天。
我的全日历代码很简单:
$(document).ready(function() {
$('#calendar').fullCalendar({
events: [{"start":"2011-10-10","end":"2011-10-11","title":"Electric Picnic","allDay":true}, {"start":"2011-10-10","end":"2011-10-11","title":"Oxeygen","allDay":true}],
// Make the first day of each week a monday
firstDay: 1,
weekMode: 'variable',
header: {
left: '',
center: 'title',
right: 'today prev,next'
}
});
});
Here's an example有人使用此插件正确显示 allDay 事件,但不清楚他们的代码/数据与我的代码/数据有何不同。
您可以通过下载 this archive 在本地重现此问题。 , 解压缩,然后打开 calendar.htm
最佳答案
我发现这是您的 CSS 问题,即 main.css
文件。第 406-413 行创建了不必要的填充。
tr>td:first-child, tr>th:first-child {
padding-left: 1.25em;
}
tr>td:last-child, tr>th:last-child {
padding-right: 1.25em;
}
注释它们,左侧(和右侧)的填充将消失。 警告:这些行可能正在您网站的其他页面上使用,因此您最好仔细编辑它们。
关于javascript - 全日历事件开始时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7707381/