Google Maps API v3:信息窗口大小不正确 [英] Google Maps API v3: InfoWindow not sizing correctly

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

问题描述

当您单击我的 Google Maps v3 上的主页图标时,我的 InfoWindow 似乎没有根据 InfoWindow 的内容正确自动调整大小.

它在不应该的时候提供滚动条.InfoWindow 应正确自动调整大小.

对原因有什么想法吗?

根据请求,为信息窗口注入 HTML 的相关 JavaScript:

listing = '

内容在这里

';

更新

此错误已由 Google 在问题中处理

https://issuetracker.google.com/issues/35823659

该修复于 2015 年 2 月在 Maps JavaScript API 3.19 版中实施.

解决方案

您应该将内容从 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>';

UPDATE

This bug was handled by Google in issue

https://issuetracker.google.com/issues/35823659

The fix was implemented in February 2015 in version 3.19 of Maps JavaScript API.

解决方案

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:信息窗口大小不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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