I am trying to change the color of one specific to Red or Green when I right click it. At the moment, when I right click and change the color, it changes the color of all events, which is not what I want. I need that particular targetted event only.
.fc-event
refers to all events but how do I denote a specific event.
All the events are being parsed via JSON object and presented on the calendar.
Here is what I have done so far, any help would be greatly appreciated :-
$(document).bind("contextmenu", function (event) {
event.preventDefault();
$(".custom-menu").data('event', $(this)).finish().toggle(100).
css({
top: event.pageY + "px",
left: event.pageX + "px"
});
});
$(document).bind("mousedown", function(e) {
// If the clicked element is not the menu
if (!$(e.target).parents(".custom-menu").length > 0) {
// Hide it
$(".custom-menu").hide(100);
}
});
// If the menu element is clicked
$("ul.custom-menu li").click(function() {
switch($(this).attr("data-action")) {
case "red":
var $event = $(".fc-event");
$event.css("background-color","red");
break;
case "green":
var $event = $(".fc-event");
$event.css("background-color","green");
break;
}
// Hide it AFTER the action was triggered
$(".custom-menu").hide(100);
});
Here is the calender being displayed.
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
events: "events.php");
})
Any assistance on how this will be done would be appreciated.
Regards,