使Google地图的内容相对于右侧而不是左侧 [英] Make Google Maps content relative to the right instead of the left

查看:160
本文介绍了使Google地图的内容相对于右侧而不是左侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上使用Google地图,当我增加地图div的大小时,内容不会相对于顶部和左侧移动(在大多数情况下这是完全合理的),新内容显示在正确和底部。我想水平翻转此行为,以便在调整其大小时,内容不会相对于顶部和右侧移动,而是将新内容显示在左侧。这可能吗?

I use google maps on a site and when I increase the size of my map's div the content doesn't move with respect to the top and the left (which is fully reasonable in most cases) and new content is shown on the right and the bottom. I'd like to flip this behaviour horizontally, so that when I resize it the content doesn't move with respect to the top and the right and the new content is shown on the left instead. Is this possible?

地图div的大小将随着动画大小和窗口大小的变化而变化,因此它必须是一个平滑的解决方案。

The size of the map div is going to get resized with animations and when the window is resized so it has to be a smooth solution.

推荐答案

您可以尝试使用 setCenter()重新调整地图的大小。您可能需要删除以此为中心的函数。

You could always try re-centering the map using setCenter() on resize. You might want to debounce the function that centers it though.

下面是关于API的一个实例文档。 EventListeners

Here's an actual example on the API docs. EventListeners

这篇关于使Google地图的内容相对于右侧而不是左侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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