mirror of
https://git.coop/cotech/website.git
synced 2024-11-24 23:53:07 +00:00
Fix bug with map display issue until resize
As the map tab is created hidden by default, leaflet seems unable to deal with the sizing properly initially, but we can hook into the "tab changed" event, and tell leaflet to recalculate the size after switching tabs
This commit is contained in:
parent
4255eb049e
commit
d634816ef5
@ -70,10 +70,11 @@
|
||||
];
|
||||
|
||||
$(document).ready(function() {
|
||||
window.app.createMapMultiMarker('map-services', 54.7, -4.2, 6, mapEntries);
|
||||
var map = window.app.createMapMultiMarker('map-services', 54.7, -4.2, 6, mapEntries);
|
||||
$('#coops-view-tabs').on('change.zf.tabs', function() {
|
||||
map.invalidateSize();
|
||||
});
|
||||
});
|
||||
|
||||
// TODO fix bug with tiles not displaying properly until window resized
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
@ -70,10 +70,11 @@
|
||||
];
|
||||
|
||||
$(document).ready(function() {
|
||||
window.app.createMapMultiMarker('map-technologies', 54.7, -4.2, 6, mapEntries);
|
||||
var map = window.app.createMapMultiMarker('map-technologies', 54.7, -4.2, 6, mapEntries);
|
||||
$('#coops-view-tabs').on('change.zf.tabs', function() {
|
||||
map.invalidateSize();
|
||||
});
|
||||
});
|
||||
|
||||
// TODO fix bug with tiles not displaying properly until window resized
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
@ -34,6 +34,7 @@ app.createMapSingleMarker = function(mapId, lat, lng, zoom, markerText) {
|
||||
var marker = L.marker([lat - 0.0005, lng]).addTo(myMap);
|
||||
marker.bindPopup(markerText).openPopup();
|
||||
}
|
||||
return window.app.map;
|
||||
}
|
||||
|
||||
app.createMapMultiMarker = function(mapId, lat, lng, zoom, markersArray) {
|
||||
@ -48,6 +49,7 @@ app.createMapMultiMarker = function(mapId, lat, lng, zoom, markersArray) {
|
||||
marker.bindPopup(markerVar.markerText);
|
||||
});
|
||||
}
|
||||
return window.app.map;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=app.js.map
|
||||
|
Loading…
Reference in New Issue
Block a user