Edit: See Matt Diamond’s comment below.
Got it! Try this:
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function() {
if (map.getZoom() > 16) map.setZoom(16);
google.maps.event.removeListener(listener);
});
Modify to your needs.
More Related Contents:
- fitbounds() in Google maps api V3 does not fit bounds
- Google Maps JS API v3 – Simple Multiple Marker Example
- Using Address Instead Of Longitude And Latitude With Google Maps API
- How to Display Multiple Google Maps per page with API V3
- Google Map API v3 — set bounds and center
- Google Map API – multiple icons in wrong spot
- What’s the API Key for in Google Maps API V3?
- google maps move marker with lat/lng from ajax success returned data
- Google Maps API V3 : How show the direction from a point A to point B (Blue line)?
- Do I need to hide API key when using google maps js API? If so, how?
- Have just one InfoWindow open in Google Maps API v3
- Google Maps – How to get the distance between two point in metre?
- Load google maps v3 dynamically with ajax
- How to get the formatted address from a dragged marker in Google Version Maps
- How to draw a polygon around a polyline in JavaScript?
- Request main road / curbside StreetView panoramas instead of back alleys from API
- Open infoWindows from an external link outside of the google map
- XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3000’ Google maps
- Animating Multiple Markers
- Google Maps API v3: How do I dynamically change the marker icon?
- Google map custom marker with css rounded corner
- How to trigger the onclick event of a marker on a Google Maps V3?
- remove route with google map
- Check if a latitude and longitude is within a circle google maps
- Add CSS styled marker to google maps
- Using Longitude/Latitude as Waypoint
- Google map multiple overlay no cumulative opacity
- Google Directions Api returning 0 routes
- Google Maps API map doesn’t appear [duplicate]
- How to connect two points in Google map..?