Created
March 3, 2013 15:27
-
-
Save chyld/5076516 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?key=#{GOOGLEKEY}&sensor=false" %> | |
<div id="map"> | |
<div id="map_canvas"></div> | |
</div> | |
html { height: 100% } | |
body { height: 100%; margin: 0; padding: 0 } | |
#map | |
{ | |
height: 100%; | |
} | |
#map_canvas | |
{ | |
width: 100%; | |
height: 100%; | |
} | |
var map; | |
var canvas; | |
$(function(){ | |
display_map(40.7316, -73.9901, 13); | |
}); | |
function display_map(lat, long, zoom) | |
{ | |
var mapOptions = { | |
center: new google.maps.LatLng(lat, long), | |
zoom: zoom, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
canvas = $('#map_canvas')[0]; | |
map = new google.maps.Map(canvas, mapOptions); | |
} | |
function add_marker(lat, long, title) | |
{ | |
var latlng = new google.maps.LatLng(lat, long); | |
var marker = new google.maps.Marker({position: latlng, map: map, title: title}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment