开发者

Disable info window shadow in google maps (v2)

Is there any way to disable the automatically generated shadow for the info window for a marker?

I'm trying to get around the bug reported at http://www.google.com/support/forum/p/maps/thread?tid=69bcc3217ee1ac68&hl=en where the sha开发者_运维知识库dow has big black marks around it that obscure the view of the map when viewed in IE 8 at any zoom level other than 100%.


Looks like, for IE 8 only, you'll have to traverse the dom, find the shadow images (iws3.png), and hide them. If you have jQuery at your disposal, then it's as simple as

$('img[src$="iws3.png"]').hide();

after the map has loaded.

Or, if you don't have jQuery, something like...

var i, imgs = document.getElementsByTagName('img');
for (i = 0; i < imgs.length; i++) {
    if (/iws3\.png/.test(imgs[i].src)) {
        imgs[i].style.display = "none";
    }
}

P.S. @Crescent Fresh, here's a screenshot:

Disable info window shadow in google maps (v2)


There is very simple solution to your problem: hide both shadow layers. This way you can be sure that all objects are hidden (even those added after hide)

var map = GMap2(...);
...
var pane;

//contains the info window shadow image
pane = map.getPane(G_MAP_FLOAT_SHADOW_PANE);
pane.style.display = "none";

//contains the marker shadow images
pane = map.getPane(G_MAP_MARKER_SHADOW_PANE);
pane.style.display = "none";

Yet another question would be how to detect conditions under which layers should be hidden...


But in V3 you don't use GMap2

I managed to disable the shadows with the following css:

div.gmnoprint div img 
{
    display: none;
}

In V2 you had:

map.getPane(G_MAP_FLOAT_SHADOW_PANE).style.display = "none";
map.getPane(G_MAP_MARKER_SHADOW_PANE).style.display = "none";

Seems that in V3 you can only access the panes in OverlayView (?)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜