Last active
June 15, 2016 14:23
-
-
Save propertyhive/e437dd2465430c7cfce014f610f2f2bc to your computer and use it in GitHub Desktop.
Display map on Property Hive full details page
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
<div id="map_canvas" style="height:300px"></div> | |
<script src="http://maps.google.com/maps/api/js"></script> | |
<script> | |
var map; // Global declaration of the map | |
function initialize_map() { | |
var myLatlng = new google.maps.LatLng(<?php echo $property->latitude; ?>, <?php echo $property->longitude; ?>); | |
var myOptions = { | |
zoom: 13, | |
center: myLatlng, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
} | |
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |
var myLatlng = new google.maps.LatLng(<?php echo $property->latitude; ?>, <?php echo $property->longitude; ?>); | |
var markerOptions = { | |
map: map, | |
position: myLatlng | |
}; | |
marker = createMarker(markerOptions); | |
} | |
function createMarker(markerOptions) { | |
var marker = new google.maps.Marker(markerOptions); | |
return marker; | |
} | |
google.maps.event.addDomListener(window, "load", initialize_map); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment