noway noway - 21 days ago 5
Javascript Question

jquery-ui-map set zoom level

I have the following code to how a map. Everything works fine except the zoom parameter. No matter what I set for zoom, it always shows the same zoom level. What can I do?

$('#pagemap').live("pageshow", function() {

$('#map_canvas').gmap().bind('init', function(evt, map) {

$('#map_canvas').gmap('getCurrentPosition', function(position, status) {

if ( status === 'OK' ) {

var clientPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

$('#map_canvas').gmap('option', 'mapTypeId', google.maps.MapTypeId.SATELLITE);

$('#map_canvas').gmap('option', 'zoom', 13);

$('#map_canvas').gmap('addMarker', {'position': clientPosition, 'bounds': true});

}
});
});
});

Answer

you need to change the 'bounds' option of the marker to false.

$('#map_canvas').gmap('addMarker', {'position': clientPosition, 'bounds': false});

If you set the property bounds to true the map will calculate the viewport and zoom automagically, overriding any zoom set in the contructor Blockquote

this is a link for more informations