Skip to content

Instantly share code, notes, and snippets.

@thebouv
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebouv/c1b66a4a42d912cda77f to your computer and use it in GitHub Desktop.
Save thebouv/c1b66a4a42d912cda77f to your computer and use it in GitHub Desktop.
Force google map to zoom so all markers show
// gMarkers is your array of markers
var bounds = new google.maps.LatLngBounds();
for(i=0;i<gMarkers.length;i++) {
bounds.extend(gMarkers[i].getPosition());
}
map.fitBounds(bounds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment