I'm having an issue with leaflet map loading incorrectly on mobile.
The map is meant to load with a lat/lng of 25.748503, -80.286949 (downtown Miami), but on mobile it loads somewhere around 25.584223, -80.028805 (off the coast in the Atlantic).
Dragging the map back to right position seems to trigger the other tiles and layers to load and so does changing the screen orientation. Also, the layers and tiles are loading fine on desktop.
I've attached pictures of how it's loading incorrectly and how it's supposed to load.
Tested this on an iPhone 6+ with Safari and Chrome.
Any ideas would be awesome, thanks!
Here's a snippet of the code used to build the map:
// from main.js
var tiles = new L.StamenTileLayer('toner-lite');
var lat = 25.748503;
var lon = -80.286949;
var map = new L.Map('map-container', {
center: new L.LatLng(lat, lon),
zoom: 8.5,
minZoom: 7,
maxZoom: 16,
zoomControl: false,
doubleClickZoom: false,
VML: true,
scrollWheelZoom: false
}).addLayer(tiles);
// from _map-container.scss
#map-container {
width: 100%;
height: 100vh;
@media (max-width: $screen-md) {
height: 50vh;
}
}
.leaflet-bottom.leaflet-left {
background: #F4F4F4;
padding: 0 0.25em;
font-size: 11px;
font-family: $sans-serif;
}