Javascript gmap中的伪影
我正在努力将谷歌地图嵌入gMaps.js 基本上所有的函数都在工作,但在某些地方,贴图会产生伪影 执行以下代码:Javascript gmap中的伪影,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,我正在努力将谷歌地图嵌入gMaps.js 基本上所有的函数都在工作,但在某些地方,贴图会产生伪影 执行以下代码: var map = new GMaps({ div: '#map_canvas', lat: 51.594664, lng: 4.778375, zoom: 16, zoomControl: true, scaleControl: false, scrollwheel: false, di
var map = new GMaps({
div: '#map_canvas',
lat: 51.594664,
lng: 4.778375,
zoom: 16,
zoomControl: true,
scaleControl: false,
scrollwheel: false,
disableDoubleClickZoom: true,
});
var image = new google.maps.MarkerImage(
'[image-link]',
new google.maps.Size(100,109), // size of the image
new google.maps.Point(0,0), // origin, in this case top-left corner
new google.maps.Point(5, 25) // anchor, i.e. the point half-way along the bottom of the image
);
map.addMarker({
lat: 51.59554,
lng: 4.789006,
title: 'TEST',
icon: image,
infoWindow: {
content: '<h2>TEST</h2><p>HTML Content</p>'
}
});
var styles = [
{
"featureType": "landscape.man_made",
"stylers": [
{ "visibility": "on" }
]
},{
"featureType": "water",
"stylers": [
{ "visibility": "simplified" },
{ "color": "#21bbe2" }
]
},{
"featureType": "poi",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "road",
"stylers": [
{ "visibility": "on" },
{ "hue": "#ff0011" },
{ "color": "#9e8baa" }
]
}
]
map.addStyle({
styledMapName:"Styled Map",
styles: styles,
mapTypeId: "map_style"
});
map.setStyle("map_style")
我找不到关于这个问题的任何信息。我试图分别删除代码的所有部分,但没有成功。它发生在Chrome和Firefox中。有什么解决方案吗?这几乎总是由页面中的CSS覆盖地图中使用的样式造成的。我敢打赌,如果你把同一张地图加载到一个没有CSS的页面上,一切都会显示得很好 当然,现在的问题将是确定哪一点的CSS是混乱的。您可以在Chrome中使用DOM检查器,或者在Firefox中使用Firebug,或者您喜欢的任何DOM检查器。选择一个包含工件的元素,然后检查该元素的“样式”面板 如果我的猜测是正确的,您将看到来自您自己的CSS的样式条目影响mapsAPI元素