This is a complete hack from messing with leaflet.js source code, but it works (at least in jsFiddle) http://jsfiddle.net/C7Rp8/4/
The idea is to google maps, "resize" or "redraw" the map when you resize the container.
The changes I made are as follows:
add id link3 to small tab in HTML
<a href="#lC" data-toggle="tab" id="link3">tab3</a>
add a listener to this tab inside $(function() {
$("body").on('shown','#link3', function() { L.Util.requestAnimFrame(map.invalidateSize,map,!1,map._container); });
The requestAniMFrame string is taken from trackResize in leaflet.js
Update from comments : Hi, I used map.invalidateSize (false); instead of L.Util.requestAnimFrame (... and it works too. Just thought I would point it out. Great answer though! - Herr Grumps
Tina CG Hoehr May 26 '12 at 2:05 a.m. 2012-05-26 02:05
source share