Skip to content

Instantly share code, notes, and snippets.

@keccers
Created January 7, 2014 16:55
Show Gist options
  • Save keccers/8302404 to your computer and use it in GitHub Desktop.
Save keccers/8302404 to your computer and use it in GitHub Desktop.
Tribe Events Map Code
<div id="tribe-events-gmap" style="height: 350px; width: 100%; margin-bottom: 15px;"></div><!-- #tribe-events-gmap -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><script src="http://maps.gstatic.com/intl/en_us/mapfiles/api-3/15/5/main.js" type="text/javascript"></script>
<script type="text/javascript">
var event_address;
function initialize() {
var myOptions = {
zoom: 15,
center: event_address,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("tribe-events-gmap"), myOptions);
var marker = new google.maps.Marker(
{
map: map,
title: "Grace Building",
position: event_address
}
);
}
function codeAddress(address) {
var geocoder= new google.maps.Geocoder();
var address = address || null;
geocoder.geocode(
{ 'address': address },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
event_address = results[0].geometry.location
initialize();
}
}
);
}
codeAddress();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment