Google Maps V3-调整地图和零星地图图块的大小 [英] Google Maps V3 - Resizing Map and Sporadic Map Tile Loading

查看:83
本文介绍了Google Maps V3-调整地图和零星地图图块的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Maps和JqueryUI Resizable()方法(来自JqueryUI 1.8.7).

I'm using Google Maps and the JqueryUI Resizable() method (from JqueryUI 1.8.7).

如果单击此地图的右下角,则可以拖动并展开它. http://www.energyjustice.net/t=eb5f7o

If you click on the bottom-right corner of this map then you can drag and expand it. http://www.energyjustice.net/t=eb5f7o

但是,如果您将其扩大,Google只会提供最大约800像素宽的地图图层.如果将其提高,它也有类似的问题.

However if you make it wider Google only provides map layers up to around 800 pixels wide. It has a similar problem if you make it taller.

如果您等待几分钟,有时会加载全套瓷砖.通常,展开地图时,其行为会非常奇怪.在Firefox中,它似乎比在Chrome中更好.为什么会这样呢? 我应该怎么做才能避免这种零星的行为?

If you wait a couple minutes, sometimes the full set of tiles will load. In general when you expand the map it behaves very strangely. It seems to work better in Firefox than in Chrome. Why is this happening? What can I do to avoid this sporadic behavior?

推荐答案

调整容器大小后,您需要通过触发调整大小"事件告诉地图填充所有可用空间.

Once the container is resized, you need to tell the map to fill all the space available by triggering the "resize" event.

下面的行在您链接的页面上起作用(调整大小后从Firebug触发)

The line below worked on the page from your link (triggered from firebug after resizing)

google.maps.event.trigger(map, 'resize');

根据JQueryUI.Resizable API文档,在触发停止"事件(调整大小结束)时调用它即可完成工作.

According to the JQueryUI.Resizable API documentation, calling it when the "stop" event is fired (end of resize) should do the job.

这篇关于Google Maps V3-调整地图和零星地图图块的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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