/
githubmirror
/
Leaflet
Обзор
Документация
Войти
/
githubmirror
/
Leaflet
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
debug/tests/popup-resize.html
46 строк
1 KB
Simon Legner
Rename `Map` to `LeafletMap` and keep `Map` as alias (#9892)
11 ноя 2025, 21:28
Не верифицирован
11 ноя 2025, 21:28
2e9b617
Код
Авторство
О чём код?
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Leaflet debug page - Popup Offset</title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" /> <link rel="stylesheet" href="../../dist/leaflet.css" /> <link rel="stylesheet" href="../css/screen.css" /> <script type="importmap"> { "imports": { "leaflet": "../../dist/leaflet-src.js" } } </script> </head> <body> <div id="map"></div> <script type="module"> import {TileLayer, LeafletMap, Marker} from 'leaflet'; const osm = new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {maxZoom: 18}); const map = new LeafletMap('map').setView([50.5, 30.51], 15).addLayer(osm); let marker = new Marker(map.getCenter()) .addTo(map); marker.bindPopup("foobar", {maxWidth: 600, trackResize: true}); // NOTE: change to true!! setTimeout(()=>{ marker.getPopup().setContent(`Lorem ipsum sit amet. <img id="image" src="https://cataas.com/cat?height=${480 + Math.random() * 80}&v=${Math.random()}" />`); }, 2500); marker.on('click',()=>{ marker.getPopup().setContent(`Lorem ipsum sit amet. <img id="image" src="https://cataas.com/cat?height=${480 + Math.random() * 80}&v=${Math.random()}" />`); }) marker.openPopup(); </script> </body> </html>