Is there a way to set the initial zoom of a map in Leaflet based on the device / scree resolution?
I'm asking because I'm using Leaflet to display an image instead of a regular map, and need to set a smaller zoom so that the whole "initial screen" is visible on tablets.
Or is there another way to do it besides setting a different zoom?
Thank you!
Use fitBounds instead of setView to center your map, and you can guarantee that the same geographic area will be visible regardless of screen size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With