"); infoWindow.open(map, marker); }); })(marker, data); //Extend each marker's position in LatLngBounds object. latlngbounds.extend(marker.position); } //Get the boundaries of the Map. var bounds = new google.maps.LatLngBounds(); //Center map and adjust Zoom based on the position of all markers. map.setCenter(latlngbounds.getCenter()); map.fitBounds(latlngbounds); // hide the button $(".view_map.button").hide(); }