Browse files

get default location by navigator.geolocation

  • Loading branch information...
1 parent 1503bc1 commit e715acb35abd2471106e44b2cebfd75e8fc293f1 @andrewsmedina andrewsmedina committed Aug 15, 2010
Showing with 9 additions and 1 deletion.
  1. +9 −1 wifimap/media/js/spots.js
View
10 wifimap/media/js/spots.js
@@ -41,7 +41,15 @@ var SpotManager = {
success: function(data){
$('#content').html(data.template);
self.bindPointLink();
- Map.map.setCenter(new google.maps.LatLng(data.center_point[1][0], data.center_point[1][1]));
+
+ navigator.geolocation.getCurrentPosition(function(){
+ var initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
+ Map.map.setCenter(initialLocation);
+
+ }, function() {
+ Map.map.setCenter(new google.maps.LatLng(data.center_point[1][0], data.center_point[1][1]));
+ });
+
self.addSpotsToMap(data.points);
}
});

0 comments on commit e715acb

Please sign in to comment.