FullCalendar - Images as events

前端 未结 2 1680
误落风尘
误落风尘 2021-01-13 04:16

Looking to use Full Calendar and to include images as events and draggable. In short, would love to see how this example https://fullcalendar.io/js/fullcalendar-3.0.1/demos/

2条回答
  •  滥情空心
    2021-01-13 04:49

    You can add any image url to your eventObject by adding the attribute "imageurl" inside of the events definition (if you just want the image, don't specify a title):

    events: [
        {
            title  : 'event',
            start  : '2016-10-12',
            end  : '2016-10-14',
            imageurl:'img/edit.png', //you can pass the image url with a variable if you wish different images for each event 
            .
            .
            .
        }
    

    After that, you add the following code in the eventRender, which will add the image icon to the event (16 width and height is a good size for a thumbnail):

    eventRender: function(event, eventElement) {
        if (event.imageurl) {
            eventElement.find("div.fc-content").prepend("");
        }
    },
    

    For further details refer to this question: Add Icon(s) in first line of an event (fullCalendar)

提交回复
热议问题