Google map not fully loaded when i open inspect element it will work

前端 未结 3 1451
情书的邮戳
情书的邮戳 2021-01-05 22:24

i have integrate a google map on my website but when i open inspect element map will work and when i close map will disappear. Please let me know what the problem

b

3条回答
  •  离开以前
    2021-01-05 22:56

    Place this code after marker is created or map is loaded:

    google.maps.event.addListenerOnce(map, 'idle', function () {
    
        google.maps.event.trigger(map, 'resize');
    
    });
    

    idle event is fired when the map becomes idle after panning or zooming.

    We are using resize method after the map becomes idle means all the loading is completed. So code waits for the map idle event (when all processing has stopped on the map) to happen, then it executes the resize method, this redraws the map to the correct dimensions.

提交回复
热议问题