こんにちは、私は現在地理位置情報で遊んでいますが、IE以外のすべてでうまく機能します.Googleをサポートしていないようで、Bingを使用したいのですが、道順をIEフレンドリーにする方法を知っている人はいますか...何日も私を悩ませています!!
私のコードは次のとおりです。
function fallback() {
var myOptions = {
center: new google.maps.LatLng(51.43255949795703, - 0.461750328540802),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("Map_Canvas"),
myOptions);
var markerPos = new google.maps.LatLng(51.43255949795703, - 0.461750328540802);
var marker = new google.maps.Marker({
position: markerPos,
map: map,
title: "The Harpers Hairdressing"
});
}
function initGeolocation() {
if (navigator.geolocation) {
// Call getCurrentPosition with success and failure callbacks
navigator.geolocation.getCurrentPosition(success, fail);
} else {
fallback()
}
}
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function success(position) {
directionsDisplay = new google.maps.DirectionsRenderer();
coords = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);
var myOptions = {
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: coords
}
map = new google.maps.Map(document.getElementById("Map_Canvas"),
myOptions);
directionsDisplay.setMap(map);
calcRoute();
}
function calcRoute() {
var start = coords;
var end = new google.maps.LatLng(51.43255949795703, - 0.461750328540802);
var request = {
origin: start,
destination: end,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
function fail() {
fallback();
}