Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FullCalendar - Images as events

Tags:

fullcalendar

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/external-dragging.html would work with small thumbnails instead of the text "My Event 1, My Event 2" etc. And have that image show up on the calendar.

Thanks in advance.

like image 837
pete Avatar asked Oct 26 '16 15:10

pete


People also ask

How do I add a picture to Fullcalendar event?

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.

How do I set events in Fullcalendar?

Here is an example of how to specify an array of events: var calendar = new Calendar(calendarEl, { events: [ { title : 'event1', start : '2010-01-01' }, { title : 'event2', start : '2010-01-05', end : '2010-01-07' }, { title : 'event3', start : '2010-01-09T12:30:00', allDay : false // will make the time show } ] });

How do I create a dynamic event in Fullcalendar?

although it is not specified on the fullcalender site, it is necessary to assign a value to the "allday" parameter to be able to add new events dynamically. If you set this value to "false", it will not add the event to the AllDay row. If you do "true" it will add to the AllDay row. Save this answer.


1 Answers

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("<img src='" + event.imageurl +"' width='16' height='16'>");
    }
},

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

like image 182
Bernardo OS Avatar answered Oct 03 '22 15:10

Bernardo OS