Support

Account

Home Forums Front-end Issues Map marker problem + map full screen

Helping

Map marker problem + map full screen

  • Hi

    My map marker does not display any data when clicked.

    You can see the page here

    I thought I had everything in my maps.js file, including:

    // show info window when marker is clicked
    		google.maps.event.addListener(marker, 'click', function() {
    
    			infowindow.open( map, marker );
    
    		});

    I also wanted this functionality: when the user clicks on the map, he gets redirected to the location in google maps.

    So far I’ve been unable to retrieve the URL correctly, though.

    I’ve tried this code, but it displays ‘undefined’ in the console

    console.log($(".acf-map a").attr('href'));
    
        $(".acf-map").click(function() {
          window.open($(".acf-map a").attr('href'));
        });

    Any ideas?

  • Was looking for something similar and found your post – not sure about the map link out, but on the content not being shown when the marker is clicked, did you include content inside the marker div?

    Such as:

    <?php 
       $location = get_field('address');
       if( !empty($location) ):
       ?>
       <div class="acf-map">
          <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>">
             <?php echo $address['address']; ?>
             <?php echo $address['lat']; ?>
             <?php echo $address['lng']; ?>
          </div>
       </div>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Map marker problem + map full screen’ is closed to new replies.