jqueryfullcalendarfullcalendar-4

Fullcalendar - how to get position of clicked event


is there a possibility to get position of clicked event with eventClick method?

 var calendar = new Calendar(calendarEl, {

  eventClick: function(info) {
    alert('Event: ' + info.event.title);
    alert('Coordinates: ' + info.jsEvent.pageX + ',' + info.jsEvent.pageY);
    alert('View: ' + info.view.type);

    // change the border color just for fun
    info.el.style.borderColor = 'red';
  }

});

info.jsEvent.pageX is returning position of mouse.

Thank you guys for your help, i've decided to use modal for this.

thank you


Solution

  • sorry i did not realize you were using V4 at first.

    you can get the calendar element with info.el
    to get the offsets of the element you could use:
    info.el.offsetLeft for the x and info.el.offsetTop for y coordinates (relative to the calendar)