Within the
<div id="map" data-tap-disabled="false" style="width: 100%; height: 100%;"></div>
, there is a leaflet map.
The structure of this page includes <ion-header>
, <ion-content>
, and <ion-footer>
. The map is located in the <ion-content>
section. My goal is to hide both the header and footer with a button.
To achieve this, I have implemented a button using L.easyButton
. Here is the code snippet:
L.easyButton('click',function(){
if(self.hideLayout){
self.map.addControl(setLayers);
self.map.addControl(setZoom);
self.map.addControl(toolBar);
self.map.addControl(setScale);
self.enableAdditionalButtons(textButton, arrowButton);
self.hideLayout = false;
self.hideFooter = false;
self.map.invalidateSize(true);
}else{
self.map.removeControl(toolBar);
self.map.removeControl(setLayers);
self.map.removeControl(setZoom);
self.map.removeControl(setScale);
self.disableAdditionalButtons(textButton, arrowButton);
self.hideLayout = true;
self.hideFooter = true;
self.map.invalidateSize(true);
}
I also included the following code within the <ion-footer>
:
<ion-footer *ngIf="!this.mapService.hideFooter">
The issue I'm facing is that the map does not resize properly and leaves a white space instead of showing the footer.
https://i.sstatic.net/K6Kiu.png
I attempted to use the invalidateSize method from leaflet, even with the setInterval function, but unfortunately, I was unsuccessful. I believe there might be some adjustments needed in the HTML and CSS, although I'm still learning and not an expert on these matters.
Thank you in advance for any assistance, and I hope my explanation was clear :)