Support » Plugin: WP Store Locator » Map on bootstrap modal

  • Resolved jeeltcraft

    (@jeeltcraft)


    Hi, I need help to resize de google map on a boostrap modal, the javascript transition that opens the modal hides the map, I can only see the marker but not the map, everyone on bootstrap community says that I need to add this code in order to make the map visible while the modal (#modal-3) has fired the shown event:

    google.maps.event.addDomListener(window, “resize”, resizingMap());

    $('#modal-3').on('shown.bs.modal', function() {
       //Must wait until the render of the modal appear, thats why we use the resizeMap and NOT resizingMap!! ;-)
       resizeMap();
    })
    
    function resizeMap() {
       if(typeof map =="undefined") return;
       setTimeout( function(){resizingMap();} , 400);
    }
    
    function resizingMap() {
       if(typeof map =="undefined") return;
       var center = map.getCenter();
       google.maps.event.trigger(map, "resize");
       map.setCenter(center);
    }

    May I add this in your wpsl-gmap.js file?

    Thanks in advance,
    LauraC

    https://wordpress.org/plugins/wp-store-locator/

Viewing 1 replies (of 1 total)
  • Thread Starter jeeltcraft

    (@jeeltcraft)

    Ok, sorry for the questions, I may have problems with chrome, the map works perfectly on bootstrap modal 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Map on bootstrap modal’ is closed to new replies.