Hi do you disable Google infoWindow on my google maps as you can see by visiting http://harpers.everythingcreative.co.uk/contact the info window looks odd and displays the incorrect address.
// ---------- Geolocation ----------
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: "3 Fir Tree Place, Church Road, Ashford, Middlesex, TW15 2PH",
travelMode: google.maps.TravelMode.DRIVING,
};
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
function fail()
{
fallback();
}
As you can see the fallback is a simple marker that doesn't display and info window but the Directions does.
On your DirectionsRenderer object you can pass in a DirectionsRendererOptions struct of options. Within that is a markerOptions value, which you should be able to use to disassociate the marker from the map.
Something like this might work:
directionsDisplay = new google.maps.DirectionsRenderer({
markerOptions : {
map: null, // you probably would only need 1 or the other of these two values
visible: false
}
});
use suppressInfoWindows:true within the layer's option:
layer = new google.maps.FusionTablesLayer({
map: map,
heatmap: {
enabled: false
},
options: {
suppressInfoWindows:true
}
});
Using duncan's fix i just used the clickable:false option and it seemed to do the trick, thank you very much!
directionsDisplay = new google.maps.DirectionsRenderer({
markerOptions : {
visible: true,
clickable: false
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.