Skip to content

Instantly share code, notes, and snippets.

@MaxLynam
Created September 22, 2015 17:23
Show Gist options
  • Save MaxLynam/db4e96a186d5bd91d8a3 to your computer and use it in GitHub Desktop.
Save MaxLynam/db4e96a186d5bd91d8a3 to your computer and use it in GitHub Desktop.
NationBuilder - Google Map Display on Event Template
//=====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