Are sheet map elements sitting in the DOM but not showing up?

Rendering flyer, because I can see all its elements in the DOM, but nothing comes to life again. Everything I see is gray.

The only way I can get the display of the map tiles is to delete the position: absolute on the map container, but this creates a bunch of broken map fragments. I checked the GIT story to see if I accidentally changed the style, but no luck.

Here is the code that initializes the card:

// init everything on page show
$("#map").live('pageshow',function() {
    if(window.localStorage.getItem("lat")!=undefined) { var lat = window.localStorage.getItem("lat")} else { var lat = '49.264'; }
    if(window.localStorage.getItem("lng")!=undefined) { var lng = window.localStorage.getItem("lng")} else { var lng = '-123.123'; }
    try {         
        var map = window.map
        map = new L.Map('map-container');
        var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/006282296d334e66a593e55aca6b5ce0/54803/256/{z}/{x}/{y}.png';
        var cloudmadeAttribution = 'Map Data © 2011 OpenStreetMap';
        var cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
        map.setView(new L.LatLng(lat, lng), 12).addLayer(cloudmade);
        map.invalidateSize();
    } catch(e) {console.log(e)}
    userMarkers[1] = new L.Marker( new L.LatLng( lat,lng ) , {icon: new iconUser, clickable: true} );
    map.addLayer( userMarkers[1] );
});

There is jQuery mobile in the environment. Unfortunately, the console does not log any errors, and the localStorage above does indeed contain valid LatLng values ​​when I check it.

Screenshot: screenshot

Any guesses?

+3
source share
1 answer

, , , , :

#map-container {
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    right:0;
    margin: 0;
    padding: 0;
}

. , , .

+4

All Articles