Leaflet: adjust popup to picture size

后端 未结 5 1814
有刺的猬
有刺的猬 2021-02-05 12:54

I\'m trying to include pictures in my leaflet popups, but the popup-size doesn\'t adjust to the picture size. I found a solution to this on github:

https://github.com/Le

5条回答
  •  花落未央
    2021-02-05 13:31

    None of the before added answers worked for me, but I came upon a quite simple solution (the link of which I can no longer find). Just wrap your image in a div:

        

    And add a simple css rule that corresponds to the image width:

        .ppcont{width:100px;}
    

    Now the popup should load correctly and it solves the need for updates or closing/opening again.

提交回复
热议问题