• Resolved Bubblechaz

    (@bubblechaz)


    Hi

    I have a google calendar showing, However I am trying to do something with JQuery for IF LOCATION CONTAINS text

    The idea is that if the location is OFFICE then I will add a class or css to li class=”event” to be something like li class=”event red” and then the background to be red for any events which have office as the location.

    However, This is hard to do currently as my Jquery loads before the shortcode. Is there any way to hook in after the shortcode?
    or some JS that can tell when the shortcode has run/calendar loaded?

    A quick example

    $(‘.location’).each(function(){
    debugger;
    if ($(‘.location:contains(“office”)’).length > 0) {
    $(this).addClass(“thisClass”); //add a class to location for now, will use jQuery to find the parent .event once this works
    alert(“done”);
    }

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author room34

    (@room34)

    I’m currently working on adding some hooks so it will be possible to write jQuery that fires off either right before or right after ICS Calendar initializes itself on the page. Ideally that will be in the update going out tomorrow, but I’m not sure yet at this point. (But it will be soon.)

    In the meantime my best suggestion is to use setTimeout() with jQuery(window).on('ready') to delay your code until after ICS Calendar loads.

    Plugin Author room34

    (@room34)

    I’ve got the jQuery hooks working now in my development environment, so this will be included in tomorrow’s update release (v. 10.10.0).

    I’ve prepared documentation that describes how to use this feature:

    https://icscalendar.com/developer/#jquery

    Plugin Author room34

    (@room34)

    Version 10.10.0 with this feature is now available.

    Thread Starter Bubblechaz

    (@bubblechaz)

    Hello

    Perfect, thank you! I will be working on this later today so hopefully everything works.

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hook to load JS after plugin shortcode loaded’ is closed to new replies.