Skip Navigation

[Résolu] Map doesn't automatically zoom properly in a Bootstrap 4 collapsed div

This support ticket is created Il y a 4 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 réponses, has 2 voix.

Last updated by Darryl Il y a 4 années.

Assisted by: Luo Yang.

Auteur
Publications
#1587373

I have a Toolset map inside of a Bootstrap 4 collapse (hidden link)

If I load the page with the div collapsed (the default) all the markers are in the right place but the map is zoomed right out.

If I add the "show" class to the div, forcing the div to display un-collapsed, the map renders just as you would expect and is zoomed in to show all markers.

<a class="btn btn-primary" data-toggle="collapse" href="#collapsemap" role="button" aria-expanded="false" aria-controls="collapsemap"><i class="fad fa-map-marked-alt"></i> Show/Hide Map</a></p>
    <div class="collapse mb-3" id="collapsemap">
      [wpv-map-render map_id="map-worksites" map_height="500px" single_zoom="15" cluster="on" spiderfy="on"][/wpv-map-render]
    </div>

Here's video to help:
hidden link?

#1587377

I just noticed that I have the map zoom set to "15". I just added that to see if it was just a problem the ditty to automatically zoom to show all markers.

#1587875

Hello,

Thanks for the details, I can see the problem in my localhost.

It is not related with Booststrap, the problem occurs when google map HTML div tag is hidden.

In your case, you can try with JS codes to reload the zoom settings after user click the "Show/Hide Map" link, for example:

jQuery( 'a[aria-controls="collapsemap"]' ).click(function( event, data ) {
    WPViews.view_addon_maps.reload_map('map-worksites');
});
#1588829

My issue is resolved now and works better than I set out to do. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.