Google Maps API v3:InfoWindow的大小无法正确调整 [英] Google Maps API v3: InfoWindow not sizing correctly

查看:811
本文介绍了Google Maps API v3:InfoWindow的大小无法正确调整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击Google地图v3上的主图标时,我的InfoWindow显示的信息窗口未正确自动调整为InfoWindow的内容。



给出滚动条,当它不应该。



每个请求,相关的JavaScript它注入InfoWindow的HTML:

  listing ='< div> Content here here< / div>'; 


解决方案

你应该从jQuery对象给InfoWindow。

  var $ infoWindowContent = $(< div class ='infowin-content'>内容在这里< / div> ); 
var infoWindow = new google.maps.InfoWindow();
infowindow.setContent($ infoWindowContent [0]);


It appears my InfoWindow, when you click on the home icon on my Google Maps v3, is not properly auto-sizing to the content of the InfoWindow.

It gives scrollbars when it should not. The InfoWindow should be properly auto-sizing.

Any ideas on why?

Per request, the relevant JavaScript which injects the HTML for the InfoWindow:

listing = '<div>Content goes here</div>';

解决方案

You should give the content to InfoWindow from jQuery object.

var $infoWindowContent = $("<div class='infowin-content'>Content goes here</div>");
var infoWindow = new google.maps.InfoWindow();
infowindow.setContent($infoWindowContent[0]);

这篇关于Google Maps API v3:InfoWindow的大小无法正确调整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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