Accessing map JS properties

Home Forums Calendar Products Events Calendar PRO Accessing map JS properties

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1149899
    Kalle
    Participant

    Hello,

    This is more of a javascript question/ I’d like to be able to access the map Javascript properties to try some customization.

    Looking at “plugins/the-events-calendar-pro/src/resources/js/tribe-events-ajax-maps.js” I see variables like tg.map, tg.marker, etc.

    How can I access these properties externally, like from my theme’s footer?

    For example, if I just want to confirm that “tg.map” is accessible, I might put something like this directly before my closing body tag:

    <script>
    alert(tg.map.join("\n"));
    </script>

    However, “tg.map” has to be written another way since I’m calling it outside of “tribe-events-ajax-maps.js”. I’m a beginner with JS so I’m not sure of the correct way.

    #1150366
    Brook
    Participant

    Howdy Kalle,

    I would love to help you with this.

    That variable would be accessible as a member of the public object:

    tribe_ev.geoloc

    So you can check if:

    tribe_ev.geoloc.map

    Is accessible.

    Just a parting tip if you’re new to JavaScript development. Using console.log() instead of alert() will make your life much easier. Console.log will give you access to the full variable, allowing you to inspect its properties.

    Please let me know if you have any questions. Cheers!

    – Brook

    #1150449
    Kalle
    Participant

    Great! Works like a charm thanks. It’s a good starting point.

    #1150677
    Brook
    Participant

    Excellent! It was my pleasure. I appreciate you getting back and letting me know that worked.

    • Brook
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Accessing map JS properties’ is closed to new replies.