当前位置:网站首页>Use Baidu map API to set an overlay (infowindow) in the map to customize the window content
Use Baidu map API to set an overlay (infowindow) in the map to customize the window content
2022-06-25 23:45:00 【langmeng110】
As the main backstage , The interface is ugly. , It doesn't work bootstrap,vue What? , It's simple css Style and html, This content can play by itself
Don't talk much , I'll just go straight to the code
html The code is as follows :
<div id="mapDiv" ></div>javaScript The code is as follows :
var map = new BMap.Map("mapDiv");
var point = new BMap.Point(87.56498774,43.84038035);
map.centerAndZoom(point,19);
var data = {};
data.title=" Alarm personnel alarm ";
data.point=point;
showAlarmMessage(data,map);
// Display prompt message
function showAlarmMessage(data,map){
var content='<div class="alarmDiv">';
content+='<table style="width:100%;height:100%;" border="1" cellpadding="0" cellspacing="0">';
content+='<tr><td rowspan="4" style="width:80px;"><img src="/css/images/alarmLamp.gif" class="alarmPic"/></td>';
content+='<td class="tabLabel"> full name </td><td class="tabText"> Li Er dog </td></tr><tr><td class="tabLabel"> ID number </td>';
content+='<td class="tabText">412825465458452125</td></tr><tr><td class="tabLabel"> Place of incident </td>';
content+='<td class="tabText"> At the east gate of Aolong square in the new urban area </td></tr> <tr> <td class="tabLabel"> Alarm equipment </td>';
content+='<td class="tabText"> Access control at the east gate of Aolong square </td> </tr> <tr> <td colspan="3">';
content+='<table border="1" class="childTab"><tr><th> Site photos </th><th> Warning photos </th></tr>' +
'<tr><td align="center"><img src="/css/images/testPerson.jpg"/></td><td align="center">' +
'<img src="/css/images/testPerson.jpg"/></td></tr></table></td></tr></table></div>';
var opts = {
width : 400, // Information window width
height: 300, // Information window height
title : data.title // Message window title
}
var infoWindow = new BMap.InfoWindow(content, opts);// Create information window object
map.openInfoWindow(infoWindow,data.point);// Open the information window
}css The code is as follows :
.tabLabel {
height: 24px;
text-align: right;
font-weight: bold;
padding-right: 5px;
}
.tabText {
padding-left: 5px;
}
.alarmPic {
width: 80px;
height: 80px;
}
.childTab {
width: 100%;
height: 100%;
}
.childTab th {
text-align: center;
height: 30px;
}
.alarmDiv {
width: 400px;
height: 275px;
}
.BMap_bubble_title{
text-align: center;
font-weight: bold;
color:red;
font-size: 15pt;
}In this way, it can be on the map point The position shows an information window , The effect is as follows :

边栏推荐
- 数据同步
- 关于go协程超时退出控制条件与方式分析
- Tree class query component
- Analysis and comprehensive summary of full type equivalent judgment in go
- 录屏转gif的好用小工具ScreenToGif,免费又好用!
- Leetcode (605) -- flower planting
- 权限设计=功能权限+数据权限
- Episode 3: thread synchronization using thread lock
- Uniapp -- framework arrangement and analysis summary
- 中序线索二叉树
猜你喜欢

YUV444、YUV422、YUV420、YUV420P、YUV420SP、YV12、YU12、NV12、NV21

后序线索二叉树

Architecture part -- the use of UMI framework and DVA

Hibernate core api/ configuration file / L1 cache details

Online customer service - charging standards and service provision of third parties

期末复习【机器学习】

流数据

STL教程5-STL基本概念及String和vector使用

Wireshark对IMAP抓包分析

OpenResty篇01-入门简介和安装配置
随机推荐
Download the latest V80 version of Google Chrome
Hibernate architecture introduction and environment construction (very detailed)
php中使用google protobuf协议环境配置
STL教程5-STL基本概念及String和vector使用
Screen recording to GIF is an easy-to-use gadget, screentogif, which is free and easy to use!
SVN
php性能优化
oracle写一个先插入一条数据,在将该数据中一个字段更新的触发器的坑
两种块级元素居中的方式
C. Planar Reflections-CodeCraft-21 and Codeforces Round #711 (Div. 2)
CSDN添加页内跳转和页外指定段落跳转
SSL/TLS、对称加密和非对称加密和TLSv1.3
mongodb
Classic image segmentation network: UNET supports libtorch deployment reasoning [with code]
The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high
对卡巴斯基发现的一个将shellcode写入evenlog的植入物的复现
mysql
Reprint: detailed explanation of qtablewidget (style, right-click menu, header collapse, multiple selection, etc.)
hiberate核心API/配置文件/一级缓存详解
Anaconda一文入门笔记