自定义地图弹窗:无需地图 API 的实现方法
#custom-popup {
position: absolute;
top: 100px;
left: 100px;
width: 200px;
height: 100px;
background-color: white;
border: 1px solid black;
padding: 10px;
}
var popup = document.getElementById('custom-popup');
function showPopup() {
popup.style.display = 'block';
}
function hidePopup() {
popup.style.display = 'none';
}
map.on('click', function(event) {
showPopup();
});
通过这种方式,您可以自定义弹窗的外观和行为,而不依赖地图 API。您可以根据需要添加其他功能,例如添加关闭按钮或动画效果等等。
原文地址: https://www.cveoy.top/t/topic/p3GA 著作权归作者所有。请勿转载和采集!