I'm trying to put a different map using Leaflet in 2 bootstrap tabs. My problem is when I switch to the other map, the map is not well rendered. If I zoom out, I can see the whole map in a small square in the middle of my tab's body. If I resize my browser (I'm using chrome), the map resize too and works, but the problem come back each time I'm switching between maps.
<div class="row">
<ul class="nav nav-tabs" id="map-tab">
<li id="tab-suivi" class="active">
<a href="#map-suivi" data-toggle="tab">Suivi</a>
</li>
<li id="tab-alarm" class="">
<a href="#map-alarm" data-toggle="tab">Alarme</a>
</li>
</ul>
<div id="cartoTabContent" class="tab-content">
<div class="tab-pane fade active in" id="map-suivi">
</div>
<div class="tab-pane fade in" id="map-alarm">
</div>
</div>
</div>
var mymap = L.map('map-suivi').setView([47.786, -3.320], 13);
var mymapalarm = L.map('map-alarm').setView([47.786, -3.320], 13);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(mymap);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(mymapalarm);
I found some post here on SO from people having similar issue with multiple maps, but none of their solutions worked for me.