Google地图为InfoWindow设置宽度 [英] Google maps set width for InfoWindow

查看:312
本文介绍了Google地图为InfoWindow设置宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用InfoWindow在Google地图上获取自定义弹出窗口,
但我无法设置它的宽度,我尝试将它设置为内联封装标签,但它不起作用。
在这种情况下,我需要它是750px。

Hi I am using InfoWindow to get custom popup on google maps, but I can't set it width, I tried setting it inline to wrapper tag, but it doesn't work. In this case I need it to be 750px.

这里是jsfiddle: http://jsfiddle.net/xxast/
这里是html文件: http://www.mediafire.com/view/?66dbe6xzn1mul10

Here is jsfiddle: http://jsfiddle.net/xxast/ and here is html file: http://www.mediafire.com/view/?66dbe6xzn1mul10

以下是设置InfoWindow内容的方法:

Here is method that is setting InfoWindow content:

 function getContent(parts, kmlEvent) {

                var content = ""+
       "<div id='width800' class='google-infobox-content' >" +
            "<div class='image'>" +
                "<img src='http://maps.google.com/maps/api/staticmap?center=" + kmlEvent.latLng.Ya + "," + kmlEvent.latLng.Za + "&amp;zoom=13&amp;size=150x150&amp;maptype=roadmap&amp;sensor=false&amp;language=&amp;markers=color:red|label:none|48.7758013,9.2529132' title='' width='150' height='150' >" +
                "<br />" +
                "<a href='https://maps.google.com/maps?sensore=true&daddr=" + kmlEvent.latLng.Za + "," + kmlEvent.latLng.Ya + "' target='_blank' >Full Google Map</a>" +
                "<a href='http://maps.google.com/help/maps/directions/Somewhere' target='_blank' >Directions</a>" +
            "</div>" +
            "<div class='location'>" +
                "<p>" + parts[0] + "</p>" +
                "<p>" + parts[1] + "</p>" +
                "<p>" + parts[2] + "</p>" +
                "<br/>" +
                "<p>" + parts[3] + "</p>" +
            "</div>" +
            "<div class='contact'>" +
                "<p>" + parts[4] + "</p>" +
                "<p>" + parts[5] + "</p>" +
                "<a href='mailto:" + parts[6] + "' >" + parts[6] + "</a>" +
                "<a href='" + parts[7] + "' target='_blank' >" + parts[7] + "</a>" +
            "</div>" +
            "<div class='others'>" +
                "<p><b>Product line</b></p>" +
                "<p>" + parts[8] + 
                "</p>" +
            "</div>" +                
        "</div>";

                return content;
            }​

更新
在此处更新jsfiddle为包装标签设置了maxWidth和inline宽度,但仍然无效: http://jsfiddle.net / xxast / 3 /

推荐答案

在infoWinfow选项中,尝试将maxWidth设置为750.还要确保样式默认情况下并不过分goole的值将google-infobox-content重命名为不同的东西。您可以尝试使用自定义信息窗口库:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html

In infoWinfow options try to set maxWidth to 750. Also to make sure the style is not overwiten by default goole values rename google-infobox-content to something different. You may try to use a custom info window library: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html

这篇关于Google地图为InfoWindow设置宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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