简体   繁体   English

如何更改此框的大小? (CSS)

[英]How can I change the size of this box? (CSS)

http://geodit.com:8000/test http://geodit.com:8000/test

If you search something. 如果您搜索什么。 Then click a result. 然后单击结果。 You'll see a white bubble pop up on the map. 您会在地图上看到一个白色的气泡。

How can I use CSS to over-ride this an make it smaller? 如何使用CSS改写它并使它变小? It's too big! 这个太大了!

If I got it right, you are talking about balloon on the map, and unfortunately you can not change its size with help of css, because balloon size is hardcoded in style attribute of balloon container (div element): 如果我做对了,那么您在地图上谈论的是气球,不幸的是,您无法在css的帮助下更改气球的大小,因为气球的大小硬编码在气球容器的样式属性(div元素)中:

<div style="width: 247px; height: 96px;">

that can not be overriden, only with help of javascript, if you get this div you can change its size (ballonContainer refers to that div): 不能被覆盖,只有在javascript的帮助下,如果您获得此div,则可以更改其大小(ballonContainer引用该div):

ballonContainer.style.width = "150px";
ballonContainer.style.height = "50px";

but you will be forced to change also other inner elements size (their size is also hardcoded in style attribute). 但您将不得不同时更改其他内部元素的大小(它们的大小也已硬编码在style属性中)。

Update 更新资料

I want the bubble to be smaller, or even disappear 我希望气泡变小,甚至消失

well, if you don't need that balloon (aka info window), then do not create it, I just see this line in your javascript: 好吧,如果您不需要该提示框(又称信息窗口),则不要创建它,我只在您的javascript中看到此行:

gInfoWindow = new google.maps.InfoWindow; 

would not it help you? 会不会对您有帮助? Or you mean something else? 还是您有其他意思?

Also you can set maxWidth option of info window to limit width of that window, something like that: 您还可以设置信息窗口的 maxWidth选项以限制该窗口的宽度,如下所示:

gInfoWindow = new google.maps.InfoWindow( { maxWidth: 150 } );

InfoWindow options are described also here 这里也介绍了InfoWindow选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM