Google Maps API 3 fitBounds padding – ensure markers are not obscured by overlaid controls

This is some kind of a hack-ish solution, but after the fitBounds, you could zoom one level out, so you get enough padding for your markers.

Assume map variable is your reference to the map object;

map.setZoom(map.getZoom() - 1);

Leave a Comment