Skip to content

Instantly share code, notes, and snippets.

@josefadamcik
Created July 14, 2011 08:18
Show Gist options
  • Save josefadamcik/1082091 to your computer and use it in GitHub Desktop.
Save josefadamcik/1082091 to your computer and use it in GitHub Desktop.
GMAP fit markers to view
var targetBounds, i, markerPositions;
markerPositions = ; //pole objektu google.mapsLatLng pro jdnotlive markery
targetBounds = new google.maps.LatLngBounds();
for (i = 0; i < markerPositions.length; i++) {
targetBounds.extend(markerPositions[i]);
}
map.fitBounds(targetBounds); //map je objekt google.maps.Map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment