how to open events in fullcalendar

Asked

Viewed 529 times

1

good night,

I am using fullcalendar, but I can’t open the event, just present it in the agenda. How do I fix it in the code?

$(document).ready(function() {	
           	
          $('#calendario').fullCalendar({
              header: {
                    left: '',
                    center: 'prev, title, next',
                    right: ''
                },
                defaultDate: '2016-10-18',
                editable: false,
                eventLimit: true,
                eventSources: [{
	                       events: [<?php echo $eventos;?>],
                			color: '#2089cf',    
                			textColor: '#fff' // an option!
                  		}]
              
             
    			});	

         });    

php events is the variable that brings all events.

Thank you

1 answer

1

One option is to use the settings "eventClick" and call a popup or navbar forwarding the event information.

$('#calendar').fullCalendar({
    eventClick: function(calEvent, jsEvent, view) {

        console.log('Event: ' + calEvent.title);  // https://fullcalendar.io/docs/event_data/Event_Object/
        console.log('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
        console.log('View: ' + view.name);

        // change the border color just for fun
        $(this).css('border-color', 'red');

        if (calEvent.url) {
            window.open(calEvent.url);
            return false;
        }
    }
});

$('#calendar').fullCalendar('addEventSource',  
    [{
        id: 9,
        title: 'Evento Popup',
        start: '2017-01-04',
        end: '2017-01-04',
        color: 'pink',
        url: 'http://google.com/',
    }]
);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.