Try this.
var center = new google.maps.LatLng(24.7756,121.0062);
var map = new google.maps.Map(document.getElementById('map_canvas'), {
center: center,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var bounds = new google.maps.LatLngBounds();
var marker, infowindow;
for (var i = 0; i < 10; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(center.lat() + Math.random() /
10, center.lng() + Math.random() / 10),
map: map
});
infowindow = new google.maps.InfoWindow({ content: 'Position ' +
(i + 1)});
infowindow.open(map, marker);
bounds.extend(marker.getPosition());
}
map.fitBounds(bounds);
On 7月10日, 上午6時28分, 3D-kreativ <[email protected]> wrote:
> Hi,
>
> After the map start a infoWindow opens without a click. But part of
> some infoWindows are outside of the map and not visible. Is there some
> way to make sure all infoWindows shows in the middle of the map?
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.