Php 需要更改FullCalendar中的事件背景和不透明度
作为后续工作,我现在有了一个完全工作的MySQL解决方案,但是如果我在数据库中设置的自定义列不是空的(图片),或者根据相同的条件更改相同的不透明度,我找不到改变背景的方法 在我的另一个问题中,我能够更改dayRender中的背景和eventRender中的不透明度:Php 需要更改FullCalendar中的事件背景和不透明度,php,mysql,css,image,fullcalendar,Php,Mysql,Css,Image,Fullcalendar,作为后续工作,我现在有了一个完全工作的MySQL解决方案,但是如果我在数据库中设置的自定义列不是空的(图片),或者根据相同的条件更改相同的不透明度,我找不到改变背景的方法 在我的另一个问题中,我能够更改dayRender中的背景和eventRender中的不透明度: dayRender: function (date, cell) { cell.css("background","url(https://www.mozilla.org/media/img/firefox/firefox-
dayRender: function (date, cell) {
cell.css("background","url(https://www.mozilla.org/media/img/firefox/firefox-256.e2c1fc556816.jpg) no-repeat center");
cell.css("background-size","contain")
},
eventRender: function(event, element) {
$(element).css("opacity", "0.75");
}
}))
现在我的js代码如下所示:
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month'
},
events: "/events.php",
dayRender: function (date, cell, view) {
cell.css("background","url(https://www.mozilla.org/media/img/firefox/firefox-256.e2c1fc556816.jpg) no-repeat center");
cell.css("background-size","contain")
},
eventRender: function(event, element) {
}
});
})
从MySQL数据库获取事件数据的PHP页面为:
<?php
// List of events
$json = array();
// Query that retrieves events
$requete = "SELECT * FROM evenement ORDER BY id";
// connection to the database
try {
$bdd = new PDO('mysql:host=localhost;dbname=HIDDEN', 'HIDDEN', 'HIDDEN');
} catch(Exception $e) {
exit('Unable to connect to database.');
}
// Execute the query
$resultat = $bdd->query($requete) or die(print_r($bdd->errorInfo()));
// sending the encoded result to success page
echo json_encode($resultat->fetchAll(PDO::FETCH_ASSOC));
?>
有人能帮我弄清楚吗
谢谢你的时间和帮助
var eventoObj = $("#calendar").fullCalendar( 'clientEvents')[0];
alert(eventoObj.picture_url)