Google maps in hidden div

后端 未结 5 856
余生分开走
余生分开走 2020-12-06 06:56

I have a page with two tabs. The first tab has photos and the second a google map. The problem is that the google map is not completely drawing because it is in a hidden div

5条回答
  •  青春惊慌失措
    2020-12-06 07:22

    This works for me:

    google.maps.event.trigger(map, 'resize');
    

    but, after the tab is shown...

    $('a[href="#mytab"]').on('shown', function (e){
           google.maps.event.trigger(map, 'resize'); moveTo(); 
         });  // realocate the map
    

    I am using bootstrap, find the similar function in jquery UI.

提交回复
热议问题