On my site here是SteetView控件(又名“衣夹人”),在Firefox下效果很好。在IE(在这种情况下为7,但也在8上测试-同样的结果)下,它破坏了衣夹人控件的显示。
这是我的地图代码:
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);
}
});
}
与我的代码和Google代码唯一真正的区别是,我使用jQuery的文档就绪函数而不是body onload事件来初始化地图。但是,无法想象这是原因(在地图的v2中有效)。
我是否已发现错误或代码中有问题?
提前致谢!
最佳答案
原来Google Maps API代码中存在错误。他们已经发布了修复程序,问题已解决。