Support

Account

Home Forums Add-ons Repeater Field Google map – unique marker ID for hovering

Helping

Google map – unique marker ID for hovering

  • Hi,

    I’m trying to achieve something like this:
    http://www.geocodezip.com/v3_mw_example_hoverchange.html

    I’m using a repeater to add markers and info to the Google map, and i’m using the basic code provided with the Google map support page.

    Since the google map API is totally new for me and I dont seem able to translate the example to a useful script compatible with the repeater i’m using, i’d love to use some help in getting an unique id per marker, and using that id to create a hover highlight effects between the information from the repeater next to my map (in the example that would be the right column) and the marker itself.

    Thank you!
    Mathieu

  • Hi @mathieu

    In the example you shared, the code uses an XML file to provide the locations. It’s located here: http://www.geocodezip.com/example.xml. The code to call it is this one:

    downloadUrl("example.xml", function(doc) {

    So the only thing you need to do is to generate an XML file and add the location from your Google Map custom field. To get the location (latitude and longitude), you can do it like this:

    <?php 
    $location = get_sub_field('location');
    ?>
    <marker lat="<?php echo $location['lat']; ?>" lng="<?php echo $location['lng']; ?>" html="Some stuff to display in the<br>Third Info Window"  label="Marker Three" />

    To learn more about it, please take a look at this page: https://www.advancedcustomfields.com/resources/google-map/. Unfortunately, customizing Google Map is not related to ACF anymore. If you need further support, please take a look at their support forum. I’m sorry for the inconvenience.

    I hope this makes sense. Thanks 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Google map – unique marker ID for hovering’ is closed to new replies.