与折叠集成的传单
Leaflet integrating with collapse
我在我的网站上集成了 Leaflet。但是,如果我将地图设置为折叠状态,则地图不会完全可见。enter image description here
var mymap = L.map('mapid').setView([33.841954, 10.995487], 11);
const mainLayer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}? access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, enter: [33.841954, 10.995487], id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'AccessToken'});
mainLayer.addTo(mymap);
展开视图后需要调用map.invalidateSize()
我在我的网站上集成了 Leaflet。但是,如果我将地图设置为折叠状态,则地图不会完全可见。enter image description here
var mymap = L.map('mapid').setView([33.841954, 10.995487], 11);
const mainLayer = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}? access_token={accessToken}', { attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, enter: [33.841954, 10.995487], id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, accessToken: 'AccessToken'});
mainLayer.addTo(mymap);
展开视图后需要调用map.invalidateSize()