0

I was wondering how to set the position of the map if there is no available geolocation or if it is disabled in the browser.

Find an example here : http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-geolocation.html/

                $('#map_canvas').gmap({ 'disableDefaultUI':true, 'callback': function() {
                    var self = this;
                    self.getCurrentPosition(function(position, status) {
                        if ( status === 'OK' ) {
                            self.set('clientPosition', new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
                            self.addMarker({'position': self.get('clientPosition'), 'bounds': true});
                            self.addShape('Circle', { 'strokeWeight': 0, 'fillColor': "#008595", 'fillOpacity': 0.25, 'center': self.get('clientPosition'), 'radius': 15, clickable: false });                                                              self.option('zoom' ,8);
                        }
                    });   
                }});
            }).load();
        });
    </script>
geocodezip
  • 158,664
  • 13
  • 220
  • 245
Wild Rock
  • 1
  • 3
  • [Google geolocation example with fallback position](https://developers.google.com/maps/documentation/javascript/examples/map-geolocation) – geocodezip Jan 08 '14 at 21:28
  • thank you , found the code inside the jquery-ui-map.js changed (0.0, 0.0) to the position that i wanted _latLng: function(latLng) { if ( !latLng ) { return new google.maps.LatLng(0.0, 0.0); }) – Wild Rock Jan 09 '14 at 02:55

0 Answers0