Created
September 22, 2015 17:23
-
-
Save MaxLynam/db4e96a186d5bd91d8a3 to your computer and use it in GitHub Desktop.
NationBuilder - Google Map Display on Event Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=====Can't get the venue name or address to come up in the Infowindow ... tried many different ways, just can't get it to output :( | |
<div id="map" style="width:100%; height:350px;"></div> | |
<script type='text/javascript'>//<![CDATA[ | |
function initMap() { | |
var myLatLng = new google.maps.LatLng({{ page.event.venue_address.lat }}, {{ page.event.venue_address.lng }}); | |
//=====Define View Options | |
var map = new google.maps.Map(document.getElementById('map'), { | |
zoom: 17, | |
center: myLatLng, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}); | |
var infowindow = new google.maps.InfoWindow({ | |
content: '{{ event.page.venue_name }}' | |
}); | |
var marker = new google.maps.Marker({ | |
position: myLatLng, | |
map: map, | |
title: '{{ event.page.venue_name }}' | |
}); | |
marker.addListener('click', function() { | |
infowindow.open(map, marker); | |
}); | |
} | |
//]]> | |
</script> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=initMap" async defer /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment