I am using popup on leaflet markers and using background as an image of fix size. Whenever the marker is placed on corner of map and then I click on marker to show pop-up ,it moves the complete map slightly for fraction of second and then the popup message goes outside the map screen. How to resolve this.
var content = 'Hi everybody I am here. How are you? Please resolve this.';
L.marker([-67, 265.5]).bindPopup(content).addTo(map);
L.marker([-21.5, 99.5]).bindPopup(content).addTo(map);
I have created a fiddle for the same :-
What I could understand is that the map shouldn't auto pan when popup
opens. The simple way is to set autoPan:false
in your popup
options. So, create the marker this way
L.marker([-67, 265.5]).bindPopup(content,{autoPan:false}).addTo(map);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.