Google maps 固定透明图像覆盖整个谷歌地图div

Google maps 固定透明图像覆盖整个谷歌地图div,google-maps,Google Maps,我想实现这样的目标: 基本上,我需要在地图顶部的图像是固定在地图div的顶部,但仍然能够拖动和所有的行动在地图上可用 我找到了一个解决方案,css3黑客指针事件指向none。 我的代码如下所示: <div id="overlayMap"></div> //the div with a transparent png background that I set the pointer-events: none; <div id="map"></div&g

我想实现这样的目标:

基本上,我需要在地图顶部的图像是固定在地图div的顶部,但仍然能够拖动和所有的行动在地图上可用

我找到了一个解决方案,css3黑客指针事件指向none。 我的代码如下所示:

<div id="overlayMap"></div> //the div with a transparent png background that I set the pointer-events: none;
<div id="map"></div>
//我设置指针事件的透明png背景的div:none;
但这并不完美,因为它在所有IE版本中都不如在Opera中工作:

我还发现:

但这并不完全是我需要的,因为我希望整个图像覆盖地图


使用谷歌地图API有什么方法可以实现这一点吗?

您可以执行以下操作

function setOpacityLayerAcrossWholeMap(map) {
    new google.maps.Rectangle({
        fillColor: 'grey',
        fillOpacity: 0.65,
        map: map,
        bounds: new google.maps.LatLngBounds(
    new google.maps.LatLng(-90, -180),
    new google.maps.LatLng(90, 180))
    });
}

我已经做了自己的作品,希望这是你正在寻找的

您还可以将
strokeWeight
设置为0,以避免默认情况下在地图周围绘制粗黑线。谢谢您的帮助!但对于图像,我仍然使用指针事件。不要认为它会允许在地图顶部添加透明图像。