简体   繁体   中英

Center map on window resize with Google Maps Engine

Trying to put map on my web page from Google's Map Engine service:

<iframe src="http://mapsengine.google.com/map/u/0/embed?mid=zcYcL12izhP0.kBlDVAO1nRr8" width="100%" height="480"></iframe>

How to center map on window resize? - JSFiddle Demo

There is no way to access the document inside the iframe, because it's located on a different domain. Therefore it's not possible to use any API-method to manipulate the map from the parent window.

The only option I see so far is to reload the iframe when the size of the parent window changes(what also changes the size of the iframe)

Demo: http://fiddle.jshell.net/doktormolle/zSHBe/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM