JQuery Mobile and Google Maps Not Rendering Correctly

后端 未结 5 2032
星月不相逢
星月不相逢 2021-02-06 00:22

I am simply trying to display a google map within a jquery mobile page. If I load the page directly it works. However, if I navigate to the page from another page it only rend

5条回答
  •  -上瘾入骨i
    2021-02-06 01:12

    I read on a website that if you have this problem it's beacuse the dom isn't totally loaded when you initialize your google map. You must add this in your code:

    $( document ).bind( "pageshow", function( event, data ){
    google.maps.event.trigger(map, 'resize');
    });
    

    It works for me. It's maybe brutal to resize at every page you show but ... it works.

提交回复
热议问题