时间:2021-07-01 10:21:17 帮助过:8人阅读
(function(){
$(document).ready(function() {
$("#Mechine_mec_points").click(function(){
__MC.Map_coordinate.getcorrdinate();
});
});
__MC.Map_coordinate = {
getcorrdinate:function(){
$.get('/index.php?r=comm/map_coordinate', function(data){ //调用boxy对应的页面,页面中就只有一个id=allmap的div
new Boxy(data,{ //在外面已经加载好百度地图AIP的js
'title':'地图坐标拾取',
'modal':true,
'draggable':false,
'unloadOnHide' : true,
'afterShow' : function(){
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point(106.566872, 29.536861), 17);
map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
map.enableContinuousZoom(); //启用地图惯性拖拽,默认禁用
function showInfo(e){
$("#Mechine_mec_points").val(e.point.lng + ", " + e.point.lat);
}
map.addEventListener("click", showInfo);
}//aftershow结束
});
return false;
});
},
}
})();