0efd4585 by 任超

feat:选择区域

1 parent 159c51b6
...@@ -103,12 +103,40 @@ $(function () { ...@@ -103,12 +103,40 @@ $(function () {
103 }; 103 };
104 var infoWindow = new BMap.InfoWindow('西安市大唐不夜城', opts); 104 var infoWindow = new BMap.InfoWindow('西安市大唐不夜城', opts);
105 var infoWindow1 = new BMap.InfoWindow('南门', opts); 105 var infoWindow1 = new BMap.InfoWindow('南门', opts);
106
106 // 点标记添加点击事件 107 // 点标记添加点击事件
107 marker.addEventListener('click', function () { 108 marker.addEventListener('click', function () {
109 $('.office_halls li').removeClass('hallActive')
110 $('.office_halls li').eq(0).addClass('hallActive')
111 point = new BMap.Point(108.95346, 34.265725);
108 map.openInfoWindow(infoWindow, point); // 开启信息窗口 112 map.openInfoWindow(infoWindow, point); // 开启信息窗口
109 }); 113 });
110 marker1.addEventListener('click', function () { 114 marker1.addEventListener('click', function () {
115 $('.office_halls li').removeClass('hallActive')
116 $('.office_halls li').eq(1).addClass('hallActive')
117 point = new BMap.Point(108.953381, 34.256923);
111 map.openInfoWindow(infoWindow1, point); // 开启信息窗口 118 map.openInfoWindow(infoWindow1, point); // 开启信息窗口
119
120
112 }); 121 });
122 // 办事大厅点亮
123 $('.office_halls li').click(function () {
124 $('.office_halls li').removeClass('hallActive')
125 $(this).addClass('hallActive')
126 var index = $(this).index();
127 if (index == 1) {
128 point = new BMap.Point(108.95346, 34.265725);
129 map.openInfoWindow(infoWindow, point); // 开启信息窗口
130 } else if (index == 2) {
131 point = new BMap.Point(108.953381, 34.256923);
132 map.openInfoWindow(infoWindow1, point);
133 }
134 })
113 135
136 infoWindow.addEventListener('close', function (type, target, point) {
137 $('.office_halls li').eq(0).removeClass('hallActive')
138 })
139 infoWindow1.addEventListener('close', function (type, target, point) {
140 $('.office_halls li').eq(1).removeClass('hallActive')
141 })
114 }) 142 })
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -111,6 +111,22 @@ ...@@ -111,6 +111,22 @@
111 .map_content { 111 .map_content {
112 margin-top: 20px; 112 margin-top: 20px;
113 } 113 }
114 .office_halls {
115 width: 15%;
116 float: left;
117 margin-right: 2%;
118 }
119 .office_halls h2 {
120 font-weight: 600;
121 margin-bottom: 6px;
122 }
123 .office_halls li{
124 line-height: 28px;
125 cursor: pointer;
126 }
127 .office_halls li:hover {
128 color: #0091FF;
129 }
114 .footer_button { 130 .footer_button {
115 margin: 20px 0; 131 margin: 20px 0;
116 text-align: center; 132 text-align: center;
...@@ -120,4 +136,9 @@ ...@@ -120,4 +136,9 @@
120 } 136 }
121 .footer_button a { 137 .footer_button a {
122 color: #fff; 138 color: #fff;
139 }
140
141 .hallActive {
142 background-color: rgb(236, 236, 236);
143 color: #0091FF;
123 } 144 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -134,7 +134,12 @@ ...@@ -134,7 +134,12 @@
134 </div> 134 </div>
135 <!-- ----------------------------------地图api--------------------------------------------------- --> 135 <!-- ----------------------------------地图api--------------------------------------------------- -->
136 <div class="map_content contentBox"> 136 <div class="map_content contentBox">
137 <div id="container" style="width: 100%;height: 500px;"></div> 137 <ul class="office_halls">
138 <h2>请选择办事大厅</h2>
139 <li>大唐不夜城</li>
140 <li>南门永宁门</li>
141 </ul>
142 <div id="container" style="width: 80%;height: 500px;"></div>
138 </div> 143 </div>
139 <div class="footer_button"> 144 <div class="footer_button">
140 <button type="button" class="layui-btn layui-btn-normal"> 145 <button type="button" class="layui-btn layui-btn-normal">
......