@
jakecigar
- window.map = new mapboxgl.Map({
Unfortunately that didn't work either. I even tried putting a delay on it, in case the 'resize()' function needed to wait for the map overlays to finish loading, but that made no difference either -even when I ratcheted the delay up to a second:
- $(window.map).delay(1000).resize();
The annoying thing is that, no matter what permutations I try, I can't be absolutely sure that the MapboxGL function is even being called in the first place. If it were my own function I could at least put a `console.log("blah blah")` in there, but the mapbox.js script runs on their servers, so I can't edit it.
The other major puzzle [as I mentioned before] is that trying to take a slightly more roundabout approach and force the map to automatically redraw by sending:
$(window).trigger('resize');
...from jQuery doesn't work either. According to the Mapbox docs, resizing the browser window automatically triggers the map.resize() function and indeed, as soon as I manually resize the window, the map instantly snaps to its correct size. So why doesn't it work programmatically? [I wonder if Mapbox are using some other means to detect a window resize than listening for the JS 'resize' event ??? ]
Oh well. Back to the drawing board!