52 lines
2.0 KiB
HTML
Executable File
52 lines
2.0 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
<style type="text/css">
|
|
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
|
|
</style>
|
|
<!-- <script type="text/javascript" src="//api.map.baidu.com/api?v=3.0&ak=ApltgmqghwNL1xDycvMZ7LS2Ly2LS6IZ"></script> -->
|
|
<script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=ApltgmqghwNL1xDycvMZ7LS2Ly2LS6IZ"></script>
|
|
<title>地图显示</title>
|
|
<style>
|
|
.BMap_bubble_pop{padding:0 !important;height: 152px;}
|
|
.BMap_bubble_top{height: 100% !important;}
|
|
.BMap_bubble_title{height: 100% !important;padding: 10px;box-sizing:border-box;}
|
|
.BMap_bubble_center{display: none;}
|
|
.BMap_bubble_title img{width: 100%;height: 100%;object-fit: cover;border-radius:4px;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="allmap"></div>
|
|
</body>
|
|
</html>
|
|
<script type="text/javascript">
|
|
function _GET(key){
|
|
var query = window.location.search.substring(1);
|
|
var vars = query.split("&");
|
|
for (var i=0;i<vars.length;i++) {
|
|
var pair = vars[i].split("=");
|
|
if(pair[0] == key){return window.decodeURIComponent(pair[1]);}
|
|
}
|
|
return false;
|
|
}
|
|
// var BMap = BMapGL;
|
|
var map = new BMapGL.Map("allmap");
|
|
var point = new BMapGL.Point(_GET('longitude'),_GET('latitude'));
|
|
map.centerAndZoom(point, 15);
|
|
map.enableScrollWheelZoom(true);//开启鼠标滚轮缩放
|
|
map.addControl(new BMapGL.ScaleControl());
|
|
map.addControl(new BMapGL.MapTypeControl());
|
|
var marker = new BMapGL.Marker(new BMapGL.Point(_GET('longitude'),_GET('latitude')));
|
|
map.addOverlay(marker);
|
|
|
|
var imageSrc = _GET('src');
|
|
if(imageSrc){
|
|
var infoWindow = new BMapGL.InfoWindow("",{width:80,height:120,title:'<img src="'+imageSrc+'">'});
|
|
map.openInfoWindow(infoWindow, point);
|
|
marker.addEventListener('click', function () {
|
|
map.openInfoWindow(infoWindow, point);
|
|
});
|
|
}
|
|
</script> |