Google map not filling modal popup

前端 未结 5 512
心在旅途
心在旅途 2021-01-14 10:46

I\'m using a modal popup when users click the map on this page here, which brings up a larger map with directions.

The map isn\'t filling the entire space however an

5条回答
  •  醉梦人生
    2021-01-14 11:30

    For completeness: if you're using Bootstrap modal window you need to use shown.bs.modal event in place of shown event.

    Here the code:

      $("#modalWindowId").on("shown.bs.modal", function(e) {
        google.maps.event.trigger(map, "resize");
        map.setCenter(markerLatLng); // Set here center map coordinates
      });
    

    Take a look here for learn more: http://coderpills.wordpress.com/2014/06/02/showing-google-map-inside-a-bootstrap-modal-window/

提交回复
热议问题