• Resolved craigsimps

    (@craigsimps)


    Hi, sorry I’m not altogether familiar with your plugin but I’m trying to support a client who is using it to display multiple locations on a Google Map.

    When the client website is scaled down to tablet and then mobile screen size, the map remains fixed width (at the width set in the backend — 800px). To fix this I added some CSS rules which switched the map width to 100%, and set a max-width equal to their desired output width. Then when moving to small screens it scaled down properly. Is this expected behaviour? Or should the map be responsive by default?

    This led to a further issue, which is that when the map was resized down it did not automatically refresh and set the map center again, so it appeared offset to the left. I implemented a workaround by adding an event listener, however, I had to do this within your init_map.js file so obviously it’ll be overwritten when you next update.

    It would be great if you could add my the code to the plugin JS, I had a look for a GitHub repo or similar but couldn’t find anything, hence why I’m posting here. The code I added the following code at line 75 onwards.

    
    google.maps.event.addDomListener(window, 'resize', function() {
        var center = gmwdmapData["main_map" + key].getCenter();
        google.maps.event.trigger(gmwdmapData["main_map" + key], 'resize');
        gmwdmapData["main_map" + key].setCenter(center);
    });
    
Viewing 1 replies (of 1 total)
  • Plugin Contributor WD Support

    (@wdsupport)

    Hello, @craigsimps!

    Thank you so much for your suggestion!

    We will add an option for scaling the map for mobile browsers. It will be available in one of the next couple of updates of Google Maps WD.

    You can follow the changelog of the plugin on this page.
    Thanks! Have a great day!

Viewing 1 replies (of 1 total)

The topic ‘Map Resize / SetCenter’ is closed to new replies.