[html]代码库
<script type="text/javascript">
function attribute(){
var p = marker.getPosition();
console.log("marker的位置是" + p.lng + "," + p.lat);
$("#gps").val(p.lng + "," + p.lat);
}
// 百度地图API功能
var map = new BMap.Map("allmap");
var point = new BMap.Point(114.025973657,22.5460535462);
map.centerAndZoom(point, 14);
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
var marker = new BMap.Marker(point);// 创建标注
//marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
marker.enableDragging();
marker.addEventListener("dragend",attribute);
map.addOverlay(marker); // 将标注添加到地图中
</script>
by: 发表于:2017-12-19 09:44:17 顶(0) | 踩(0) 回复
??
回复评论