George L
George L

Reputation: 1738

Dayclick on mousedown in FullCalendar

Dayclick only fires on mouseup event. I am trying to create a draggable event creator in agenda mode, and need to capture the mouseDown event.

Is there a way to do this?

Upvotes: 2

Views: 962

Answers (1)

user6269864
user6269864

Reputation:

There are a few ways to do this, but none of this is supported by fullcalendar out of the box.

1) The wrong but quick way would be just to edit the fullcalendar.js to change the event to mousedown.

2) Bind your function to all events at once:

$(document).on('mousedown','.day',function(jsEvent){ 
    YourFunctionHere();    
});

3) Bind your function to each event as it is being rendered on screen:

eventRender: function (jsEvent, element) {
    element.bind('mousedown', function (jsEvent2) {
        YourFunctionHere();
    });
}

If necessary, use jsEvent.which to filter out right clicks.

Upvotes: 1

Related Questions