I have a google maps where I can click on the map and markers appear:
var myOptions = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.HYBRID,
draggableCursor: 'crosshair',
draggable: true,
panControl: true,
zoomControl: true,
scaleControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
}
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
Wherever I click, a function gets called to do some work (add markers).
I've been asked to add a kml layer:
var url = window.location.protocol + "//" + window.location.host + "/data/polygon.cfm?TYPE=GEOID&VALUE=" + getUrlVars()["GEOID"] + "&LC=641400FF&LW=3&FC=14F11C2E&F=1&FO=1";
var kmlLayer = new google.maps.KmlLayer(url, {
suppressInfoWindows: true,
preserveViewport: false,
map: map
});
now, once the kml layer is added, the "crosshair" is gone, and I can't click on the map anymore. Is there a setting in the kmlLayer that I can set that "ignores" the layer while still displaying it?
Thanks.
Change your KML initialization code from:
var kmlLayer = new google.maps.KmlLayer(url, {
suppressInfoWindows: true,
preserveViewport: false,
map: map
});
to
var ctaLayer = new google.maps.KmlLayer(
{
url: url,
suppressInfoWindows: true,
map:map,
zindex: 0,
clickable : false
});
Here is a fiddle: http://jsfiddle.net/loanburger/jnrnmog4/ You can click the map and the marker which is over the KML
The key being the clickable = false property on the KML Layer option
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.