Google地图窗口只显示部分地图 [英] Google Maps Window only showing part of the map

查看:113
本文介绍了Google地图窗口只显示部分地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去我在很多网站上都使用过Google地图,但是我遇到过一个我以前从未遇到过的问题。地图窗口正在显示,但它只显示左上方的地图片段,之后的任何内容(即使我在左右导航时),没有任何内容加载到右侧。它就好像被导航的窗口有一个内部偏移量,它将它从视口的侧面推开。有人知道可能是什么原因造成的吗?



编辑

发现当窗口被调整大小时,地图刷新,并且布局是固定的。



地图包含在通过javascript显示的标签中(并且通过显示:无)。 tab容器是通过ajax加载的,加载时会调用loadMap函数。我试图通过将它包含在setTimeout函数中来推迟loadMap函数,该函数将地图的创建时间延迟1秒,但它仍然保持不变(需要调整窗口的大小以修复它)。
<我不知道为什么它不起作用,但我已经改变了我的代码,只在第一次打开标签时执行地图创建功能。这使它正常工作


I have used Google Maps on many websites in the past, but I have been posed with an issue I haven't experienced before. The maps window is showing, but it's only showing maps segments from the top left, and anything after that (even when i'm navigating around), nothing loads to the right. Its as if the window that is navigated around has an internal offset that is pushing it off the side of the viewport. Does anyone know what could be causing it?

EDIT

I have just discovered that when the window is resized, the map refreshes, and the layout is fixed.

The map is contained within a tab that is shown via javascript (and hidden via display:none). The tab container is loaded via ajax, and when it loads, the loadMap function is called. I tried postponing the loadMap function by enclosing it within a setTimeout function that delays the creation of the map by 1 second, but it still does the same (requiring the window to be resized to fix it)

解决方案

Righto, I am not sure why it's not working, but I have changed my code to only execute the map creation function when the tab is first opened. That makes it work correctly

这篇关于Google地图窗口只显示部分地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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