6
使用Google Maps API v3中的多个标记自动对中地图
这是我用来显示具有3个图钉/标记的地图的方法: <script> function initialize() { var locations = [ ['DESCRIPTION', 41.926979, 12.517385, 3], ['DESCRIPTION', 41.914873, 12.506486, 2], ['DESCRIPTION', 41.918574, 12.507201, 1] ]; var map = new google.maps.Map(document.getElementById('map'), { zoom: 15, center: new google.maps.LatLng(41.923, 12.513), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i …