我一直在寻找一些代码来使用图像作为全日历中事件的背景( fullcalendar jQuery ),但我所能找到的只是向所述事件添加图标的代码。
我想做这样的事情:
更新:2016-09-23 晚上 8:15美国东部时间:
我一直在尝试:
eventRender: function(event, element) {
$(element).find(".fc-day").css("background","url(https://www.mozilla.org/media/img/firefox/firefox-256.e2c1fc556816.jpg) no-repeat");
$(element).find(".fc-day").css("background-size","contain");
}
});
到目前为止还没有成功,我将继续寻找我所缺少的东西。
更新:2016-09-24 下午 2:00美国东部时间
进展:
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");
}
});
现在我只需要找到一种方法来更改特定事件的背景和不透明度,因为该事件将存储在 MySQL 数据库中,正如我在评论中指定的那样(没有图片的事件不应有背景或不透明度) .
最佳答案
你可以像 @madalin ivascu 提到的那样使用 CSS 来做到这一点
https://jsfiddle.net/j49qtcge/
#calendar td.fc-day {
background: url('https://www.mozilla.org/media/img/firefox/firefox-256.e2c1fc556816.jpg') no-repeat;
background-size: contain; // cover?
}
#calendar a.fc-event {
opacity: 0.75;
}
使用“月”以外的 View 可能需要不同的 CSS
关于jquery - 在全日历中显示图像作为背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39653635/