3 Star 0 Fork 0

mirrors_ReneNyffenegger/about-Leaflet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
layerGroup-popup.html 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
Rene Nyffenegger 提交于 2022-09-28 12:18 . no xxx
<!DOCTYPE html>
<html>
<head>
<title>Popups</title>
<meta charset="UTF-8">
<meta http-equiv="content-language" content="en" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<link rel = "stylesheet"
href = "https://unpkg.com/leaflet@1.9.1/dist/leaflet.css"
integrity = "sha256-sA+zWATbFveLLNqWO2gtiw3HL/lh1giY/Inf1BJ0z14="
crossorigin = "" />
<script src = "https://unpkg.com/leaflet@1.9.1/dist/leaflet.js"
integrity = "sha256-NDI0K41gVbWqfkkaHj15IzU7PtMoelkzyKp8TOaFQ3s="
crossorigin = ""></script>
<style>
#text{
text-align: center
}
#map {
position : relative;
margin : 0 auto;
height : 500px;
width : 500px;
box-shadow: 8px 8px 5px 0px rgba(4,25,5,0.75);
}
</style>
</head>
<body>
<div id="text">Click on the circle, marker or polygon to show a popup!</div><p>
<div id="map"></div>
<script>
var map = L.map('map', {
center: [49.7128, -2.2165],
zoom : 15
});
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: '© OpenStreetMap'}).addTo(map);
var circle = L.circle(
[49.7128, -2.2165],
{ color: 'red', fillColor: '#f03', fillOpacity: 0.5, radius: 20 });
var polygon = L.polygon([
[49.7128, -2.2165],
[49.7125, -2.2174],
[49.7133, -2.2174],
[49.7135, -2.2165] ],
{ color: '#dde21a', fillColor: 'yellow', fillOpacity: 0.9 });
var marker = L.marker([49.7137, -2.2158]);
marker.bindPopup ("<b>The simple marker</b>" );
polygon.bindPopup("<b>The yellow poligon</b>");
circle.bindPopup ("<b>The red circle</b>" );
var layerGrp = L.layerGroup([marker, polygon, circle]).addTo(map);
var overlayMaps = { "Popup Elements": layerGrp };
L.control.layers(overlayMaps).addTo(map);
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_ReneNyffenegger/about-Leaflet.git
git@gitee.com:mirrors_ReneNyffenegger/about-Leaflet.git
mirrors_ReneNyffenegger
about-Leaflet
about-Leaflet
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385