Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding map-loading js

  • Loading branch information...
commit be3fc1cea78fb34df045d22bbe6d5a67f65ff17c 1 parent 3dc1974
Pat Allan pat authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 public/javascripts/application.js
16 public/javascripts/application.js
View
@@ -1,2 +1,18 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
+var map_element = document.getElementById('map');
+if (map_element) {
+ var map = new GMap2(map_element);
+
+ // Give the map an initial centre of Melbourne, Australia
+ var geocoder = new GClientGeocoder();
+ geocoder.getLatLng("Melbourne, Australia", function(point) {
+ if (!point) return;
+
+ map.setCenter(point, 10);
+ });
+
+ // Add basic map controls
+ map.addControl(new GMapTypeControl());
+ map.addControl(new GLargeMapControl());
+}
Please sign in to comment.
Something went wrong with that request. Please try again.