我正在使用带有 jQuery 的 fullcalender,我想知道它是否可能,如果我的数组有,'bold' = true/false,
我可以使用 jquery 将一个新类附加到它。
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: false,
allDay: false,
events: "json-events.php",
eventDrop: function(event, delta) {
alert(event.title + ' was moved ' + delta + ' days\n' +
'(You cannot update these fields!)');
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
},
});
});
如果我有一个数据库值 id 'bold',我可以让 jquery 添加一个样式'title'。
$result = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row){
$return[]=array('id'=>$row['id'],
'title'=>$row['title'],
'start'=>$row['start'].' '.$row['time'],
'end'=>$row['end'],
'url'=>$row['url'],
'backgroundColor'=>$row['backgroundColor'],
'textColor'=>$row['textColor'],
'borderColor'=>$row['borderColor'],
'description'=>$row['description'],
"allDay" => false);
}
$dbh = null;
header('Content-type: application/json');
echo json_encode($return);
我想使用 jQuery 或编辑 phpscript 可能。但我不想编辑 fullcalender.js 文件。
编辑
我一直在研究这个,如果 events:"json-events.php" 我可以添加一个函数来为 css 添加粗体样式。
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: false,
allDay: false,
events: function() {...
也许通过添加 getElementById 的变量,如果它是真的,让它附加一个样式到 css。