我有一个非常奇怪的错误,当我尝试调整地图大小以适应我放在它上面的标记时,它会导致我的浏览器冻结.
我的调整大小代码供参考:
function sizeMap() {
// create a new bounds object to define the new boundry
var bounds = new google.maps.LatLngBounds();
// loop through each the string latlang values held in the latlng
// aray
for ( var i = 0; i <latlngArray.length ; i++) {
// create a new LatLng object based on the string value
var tempLatLng = new google.maps.LatLng(latlngArray[i]);
// extend the latlng bounds based on the new location
bounds.extend(tempLatLng);
}
// map.fitBounds(bounds); <== everything seems to …Run Code Online (Sandbox Code Playgroud)