• Resolved Space

    (@bkno)


    Hi,

    I am using the jQuery event r34ics_init_end on a page that has multiple calendars embedded.

    This event fires after each calendar init completes, but there doesn’t seem to be a determine the calendar that triggered it.

    In my case, I have 10 mini calendar feeds on one page and need to run custom JS which analyses the calendar’s output. I have found a workaround, but it involves checking all calendars on the page, on each init (not efficient). Being able to pinpoint which calendar fired the event, for example by its CSS ID would be very useful.

    This is probably a feature request! I love your plugin by the way.

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

    (@room34)

    I take it you’re loading all of the calendars with AJAX, is that correct? Normally the event just fires off when the page finishes loading, but then it does also fire off after each AJAX calendar loads, because it’s not aware of whether or not there are multiple calendars on the page.

    I’ll investigate the feasibility of making it aware of the DOM id of the calendar that it loaded with.

    Thread Starter Space

    (@bkno)

    Thanks, appreciate the reply.

    Can confirm I’m using Ajax to load the calendars. That was a great feature to help keep the page load fast.

    Plugin Author room34

    (@room34)

    I have this ready to go in the next update, which should be released sometime this week.

    I am now passing the DOM element object with the trigger, so you can access any properties of the element. Note that this is only relevant if the calendar is being loaded via AJAX.

    Here’s some sample code that will display an alert box containing the id of the DOM element that loaded the AJAX calendar, with a check that the id property is defined:

    jQuery(document).on('r34ics_init_start', function(e, elem) {
    if (typeof elem.attr('id') != 'undefined') {
    alert(elem.attr('id'));
    }
    });

    Note that when calling a function on a JavaScript event, the first input parameter e is the event itself. My custom parameter elem is the second parameter.

    • This reply was modified 6 days, 14 hours ago by room34.
    Thread Starter Space

    (@bkno)

    That is fantastic news, many thanks. I look forward to using this when released.

    Thread Starter Space

    (@bkno)

    Working perfectly. 👍🙏

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.