嗨,我正在使用 InfoWindow 在谷歌地图上获取自定义弹出窗口,但我无法设置它的宽度,我尝试将其设置为内联包装标签,但它不起作用。在这种情况下,我需要它是 750px。
这是 jsfiddle: http: //jsfiddle.net/xxast/ ,这是 html 文件:http ://www.mediafire.com/view/?66dbe6xzn1mul10
这是设置 InfoWindow 内容的方法:
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 + "&zoom=13&size=150x150&maptype=roadmap&sensor=false&language=&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 和内联宽度,但它仍然不起作用:http: //jsfiddle.net/xxast/3/