Closed (works as designed)
Project:
FullCalendar
Version:
7.x-2.0-beta3
Component:
JavaScript
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
20 Mar 2012 at 16:28 UTC
Updated:
25 Feb 2013 at 20:52 UTC
I am trying to add a class to the .fc-event element via jQuery and it will not apply the class. Is there any reason for this? Do I have to use some type of ajax request to make this happen. Just using the basic code below:
$('.fc-event').addClass('test');
Comments
Comment #1
jsheffers commentedI can add a class to the .fullcalendar containing div, but it won't apply to anything inside that div.
Comment #2
tim.plunkettHow are you using jQuery to do that?
$(document).ready()will not work, because everything inside .fullcalendar is dynamically generated AFTER that. Try using Drupal.behaviors: http://drupal.org/node/171213#behaviorsComment #3
jsheffers commentedThis still doesn't work...
Comment #4
tim.plunkettWell, that's Drupal 6 syntax for one. Also, when you try the D7 one, if it doesn't work try
Drupal.behaviors.ZZZcalendarItemsto ensure its not a priority thing.Comment #5
jsheffers commentedOk so I think this is the D7 version based on the link you sent me. Still not working.
Is there a special way I need to add this? The javascript file is included via the .info file, and inspecting it shows that the code is included.
Comment #6
tim.plunkettAlright, thanks for spending the time to test that out, I'll have to dig into it more I guess.
Comment #7
jsheffers commentedHey Tim, Have you had any time to look into this?
Comment #8
slcp commentedI have had a similar problem. This due to the weighting order (or lack of) for Drupal.behaviors.
Use the Behavior Weights module to ensure you code is being invoked after FullCalendar has created the calendar in the DOM.