how to open events in fullcalendar

1

Good evening,

I'm using fullcalendar, but I can not open the event, just show it in the calendar. How do I get this 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 holds all events.

Thank you

    
asked by anonymous 26.10.2016 / 04:40

1 answer

1

One option is to use the " eventClick " setting and call a popup or navbar by passing 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/',
    }]
);
    
14.12.2016 / 11:43