0
On my site here,SteetView控件,又名「Pegman」,在Firefox中很有效。在IE下(在這種情況下爲7,但也在8上測試過 - 同樣的結果),它打破了pegman控制的顯示。爲什麼Internet Explorer會在Google Maps API v3中打破「pegman」顯示?
這裏是我的地圖代碼:
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
directionsDisplay = new google.maps.DirectionsRenderer();
var milBase = new google.maps.LatLng(35.79648921414565, 139.40663874149323);
var mapOpts = {
streetViewControl: true,
zoom: 12,
center: milBase,
mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map($("#dirMap").get(0), mapOpts);
directionsDisplay.setMap(map);
var basePoly = new google.maps.Polygon({
paths: [new google.maps.LatLng(35.724496338474104, 139.3444061279297), new google.maps.LatLng(35.74748750802863, 139.3363380432129), new google.maps.LatLng(35.75765724051559, 139.34303283691406), new google.maps.LatLng(35.76545779822543, 139.3418312072754), new google.maps.LatLng(35.767547103447725, 139.3476676940918), new google.maps.LatLng(35.75835374997911, 139.34955596923828), new google.maps.LatLng(35.755149755962755, 139.3567657470703), new google.maps.LatLng(35.74679090345495, 139.35796737670898), new google.maps.LatLng(35.74762682821177, 139.36294555664062), new google.maps.LatLng(35.744422402303826, 139.36346054077148), new google.maps.LatLng(35.74860206266584, 139.36946868896484), new google.maps.LatLng(35.735644401200986, 139.36843872070312), new google.maps.LatLng(35.73843117306677, 139.36174392700195), new google.maps.LatLng(35.73592308277646, 139.3531608581543), new google.maps.LatLng(35.72686543236113, 139.35298919677734), new google.maps.LatLng(35.724496338474104, 139.3444061279297)],
strokeColor: "#ff0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
basePoly.setMap(map);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(35.79648921414565, 139.40663874149323),
map: map,
title: "Ruby International"
});
function calcRoute() {
var start = new google.maps.LatLng(35.74005964772476, 139.37083393335342);
var end = new google.maps.LatLng(35.79648921414565, 139.40663874149323);
var request = {
origin: start,
destination: end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
從我的代碼和谷歌的代碼,唯一的區別是,我使用jQuery的文件準備功能,而不是身體onload事件初始化我的地圖。無法想象那是它的原因(適用於地圖的第2版)。
我發現了一個錯誤,或者在我的代碼中出現錯誤嗎?
提前致謝!