无论什么情况,InfoWindow都会显示最小尺寸 [英] InfoWindow appears minimum size no matter what

查看:37
本文介绍了无论什么情况,InfoWindow都会显示最小尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一些与此主题相关的帖子,但是我已经将所看似的内容应用到了我读到的所有内容中:

There are several posts relating to this topic here but I've applied what seemed relevant on everything I read:

CSS

.infoWindow {
    width: 90px;
    height: 90px;
}

创建信息窗口"并分配给标记

var infowindow = new google.maps.InfoWindow({
    content: '<div class="infoWindow">Test</div>',
    maxWidth: 100
});

infowindow.open(map,test);

结果

您可以看到信息窗口以最小尺寸显示,并且看不到任何文本,如果我去除了< div> 标记和所有样式参数,然后尝试显示,也是这种情况测试".

As you can see the InfoWindow appears at minimum size and no text is visible, this is also the case if I strip out the <div> tag and all styling parameters and just try to display "Test".

您可以在此处亲自检查实时站点(将鼠标悬停在屏幕右上方以显示地图)

为什么InfoWindow坚持保持最小尺寸?

原来,此问题仅在缓存页面时在重新加载"(即IE)上发生.每次我清除缓存都可以正常工作,但是如果我重新加载页面而不清除缓存,则它会如上图所示.在Firefox&上尝试过Chrome,OSX

推荐答案

尝试使用此解决方案将内容放入变量中.

try this solution putting the content inside a variable.

var content='<div class="infoWindow">Test</div>';

var infowindow = new google.maps.InfoWindow({
    content:content,
    maxWidth: 100
});

过去,我遇到了类似的问题,并且可以解决问题.

in the past I had similar problem and this worked.

更新

我已根据Infowindow 中删除了一些选项.>此文档.

I have removed some options from Infowindow according to this documentation.

InfoWindowOptions对象文字包含以下字段:
1)内容
2)位置
3)maxWidth

The InfoWindowOptions object literal contains the following fields:
1)content
2)position
3)maxWidth

更新2

min-height min-width css属性设置为您的 .infoWindow

set min-height, min-width css property to your .infoWindow class

更新3

请参见堆栈问题您的新问题

see this stack question for your new problem

这篇关于无论什么情况,InfoWindow都会显示最小尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆