<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>食堂餐厅地图</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.0&type=webgl&ak=ilfG6CNWbp3rE5SwGqkHhImDmGp7tUO8"></script>
<style>
/*默认的宽:1440px;默认的高:1024px*/
#logo {
width: 18%;
height: 13%;
float: left;
}
#head {
width: 82%;
height: 13%;
float: left;
position: relative; left: 18%;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
font-size: x-large;
}
#map {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
margin: 0;
font-family: "微软雅黑";
}
#table {
width: 28%;
height: 87%;
position: absolute; left: 0; top: 140px;
}
#scene {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
#food {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
#post {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
#sport {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
#traffic {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
#shopping {
width: 200px;
height: 100px;
background-color: brown;
color: azure;
text-align: center;
line-height: 100px;
}
ul li {
list-style: none;
}
.btn-wrap {
z-index: 999;
position: fixed;
bottom: 3.5rem;
margin-left: 3rem;
padding: 1rem 1rem;
border-radius: .25rem;
background-color: #fff;
box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
}
.btn {
width: 75px;
height: 30px;
float: left;
background-color: #fff;
color: rgba(27, 142, 236, 1);
font-size: 14px;
border:1px solid rgba(27, 142, 236, 1);
border-radius: 5px;
margin: 0 5px;
text-align: center;
line-height: 30px;
}
.btn:hover {
background-color: rgba(27, 142, 236, 0.8);
color: #fff;
}
</style>
</head>
<body>
<div id="logo">
<img src="logo0.png" width="10%" style="position: absolute; left: 3%; top: 0;">
</div>
<div id="head">
<img src="whitelogo.png" width="300px" height="134px" style="position: absolute; left: 350px;">
<img src="red.jpg" width="1182px" height="134px">
</div>
<div id="map">
<img src="lightred.jpg" width="1440px" height="890px">
</div>
<div id="table">
<div id="scene">
<h2>景点</h2>
</div>
<div id="food">
<h2>饮食</h2>
</div>
<div id="post">
<h2>快递</h2>
</div>
<div id="sport">
<h2>运动</h2>
</div>
<div id="traffic">
<h2>交通</h2>
</div>
<div id="shopping">
<h2>购物</h2>
</div>
</div>
<ul class="btn-wrap" style="z-index: 99;">
<li class = "btn" onclick = "addRouteType()">叠加路况</li>
<li class = "btn" onclick = "removeRouteType()">删除路况</li>
</ul>
<script>
var map = new BMapGL.Map("map"); // 创建地图实例
var point = new BMapGL.Point(116.404, 39.915); // 创建点坐标
map.centerAndZoom(point, 15); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
map.setHeading(64.5); //设置地图旋转角度
map.setTilt(73); //设置地图的倾斜角度
function addRouteType() {
map.setTrafficOn(); // 叠加路况图层
}
function removeRouteType() {
map.setTrafficOff(); // 关闭路况图层
}
</script>
</body>
</html>