当前位置:网站首页>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 :

边栏推荐
- excel如何实现中文单词自动翻译成英文?这个公式教你了
- QT custom implemented calendar control
- Once beego failed to find bee after passing the go get command Exe's pit
- proxy
- Px4 simulation basis
- oracle写一个先插入一条数据,在将该数据中一个字段更新的触发器的坑
- debezium
- 期末复习【机器学习】
- 一文讲透研发效能!您关心的问题都在
- Run the dronekit flight control application on Shumei faction under px4-jmavsim software simulation environment
猜你喜欢

QT Chinese and English use different fonts respectively

What is Unified Extensible Firmware Interface (UEFI)?

森林的先序和中序遍历

hiberate实体类CURD、事务操作汇总

Kylin

如何进行流程创新,以最经济的方式提升产品体验?

The simplest screen recording to GIF gadget in history, licecap, can be tried if the requirements are not high

Uniapp -- list page of multi header tabs

debezium

BI-SQL丨存储过程(一)
随机推荐
SSL/TLS、对称加密和非对称加密和TLSv1.3
Graduation trip | recommended 5-day trip to London
QT Chinese and English use different fonts respectively
The software test interview has been suspended. The interviewer always says that the logical thinking is chaotic. What should I do?
hiberate架构介绍及环境搭建(非常详细)
util. Collection and encapsulation of JS tool functions
Gradle的环境安装与配置
Qlabel text scrolling horizontally
c_ uart_ interface_ Example and offboard modes
Anaconda一文入门笔记
Summary of common JDBC exceptions and error solutions
中序线索二叉树
Extraction system apk
.user.ini文件导致的php网站安装问题
Ad20 learning notes II
第六章 习题(678)【微机原理】【习题】
php进程间传递文件描述符
Analysis on resource leakage /goroutine leakage / memory leakage /cpu full in go
A. Balance the Bits--Codeforces Round #712 (Div. 1)
解决TypeError: Unicode-objects must be encoded before hashing