Google Maps does not render correctly in IE8 within iframe nyromodal layer

£可爱£侵袭症+ 提交于 2019-12-20 07:33:44

问题


I try to render a google map within a nyromodal iframe layer.

It works fine in Chrome and Firefox, but in IE8 there is a strange issue: On first load, it works fine. Yet after I close the layer and reopen it on the same page, the map will render false: only mostly showing grey tiles and and and all its content will be splattered randomly, e.g. like so:

If I clear the cache and reload, the map will work again but only one time.


回答1:


The problem most likely lies within the fact that nyromodal needs time to fully open, while the google API already tries to render the map. Hence it works when clearing the cache, as there is a timeout before all resources are loaded, allowing nyromodal the option to completely open.

So in order to enforce a timeout to fully load the nyromodal, initalize your map in your iframe via

$(document).ready(function () {

 /* set up your map */

 setTimeout(
   function() {
     initalizeYourMap();
 },
 1000);

});



来源:https://stackoverflow.com/questions/10949167/google-maps-does-not-render-correctly-in-ie8-within-iframe-nyromodal-layer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!