- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个动态添加事件到日历的功能。
function AddEventSourceDetailed(act_id) {
$('#calendar').fullCalendar('addEventSource', function (start, end, callback) {
var startTime = Math.round($('#calendar').fullCalendar('getView').start.getTime() / 1000);
var endTime = Math.round($('#calendar').fullCalendar('getView').end.getTime() / 1000);
time = endTime - startTime;
//alert(time);
if (time <= 604800) {
$.ajax({
type: 'POST',
url: '/Employee/GetScheduleDetailedArray/',
async: false,
dataType: "json",
data: {
// our hypothetical feed requires UNIX timestamps
start: Math.round(start.getTime() / 1000),
end: Math.round(end.getTime() / 1000),
id: '@Model.selectedUserId',
act: act_id
},
success: function (doc) {
callback(doc);
},
error: function (xhr, status, error) {
document.appendChild(xhr.responseText);
}
}); //end ajax
} else {
callback();
}
});
}
问题是我不知道如何在以这种方式添加时为事件源分配颜色。
====编辑=====
好吧,我找到了一种更改事件内部背景颜色的 hackish 方法,我使用 eventAfterRender 及其元素对象将其与我具有关联颜色的事件列表进行比较。我希望在我找到更好的方法之前,这会对某人有所帮助
$('#calendar').fullCalendar({
height: 600,
width: 700,
header: {
right: 'prev,next today',
center: 'title',
left: 'month,agendaWeek,agendaDay'
},
eventAfterRender: function (event, element, view) {
for (x = 0; x < activityColors[0].length; x++) {
if (event.id == activityColors[0][x]) {
element.children().css({ "background-color": "#" + activityColors[1][x] })
}
}
}
});
最佳答案
您可以使用:
$('#calendar').fullCalendar( 'addEventSource', {
url: "/url/goes/here",
color: '#05ABBD'
});
关于javascript - fullCalendar - 带有颜色选项的 addEventSource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7598644/
我正在创建一个待命计划,用户可以在其中选择具有成员列表以及轮换时间和类型的组。当用户单击“创建计划”按钮时,日历上会显示代表此轮换计划的事件列表。事件已创建并添加到事件数组中,但它们不会显示在日历上。
我有一个动态添加事件到日历的功能。 function AddEventSourceDetailed(act_id) { $('#calendar').fullCalendar('addEven
你能说说这有什么问题吗?我有一个名为的 javascript 函数,它创建一个新的事件数组并尝试刷新 fullcalendar。 var events=new Array(); var numbero
当我点击dayClick时,我想向点击的日期添加一个事件。 我有以下 JS 代码: $('#calendar').fullCalendar({ header: { center: "tit
我想为一整天添加背景颜色,而不仅仅是事件背景。对于我现在编写的代码,我可以单独将事件视为背景 我的 View 代码如下: $(document).ready(function() {
其实标题已经说明了一切。我做了一个ajax调用,它返回一个事件列表。然后我想将该列表放入fullcalendar中。此操作应该适用于每个更改的选定用户名。 $.ajax({ type: "PO
我目前正在尝试测试 FullCalendar(版本 2.2.6)addEventSource $('button').click(function() { $("#calendar").ful
我是一名优秀的程序员,十分优秀!