JavaScript+HTML
设置markerOptions属性* {
margin: 0px;
padding: 0px;
}
body,
button,
input,
select,
textarea {
font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
}
p {
width: 603px;
padding-top: 3px;
margin-top: 10px;
overflow: hidden;
}
.btn {
width: 112px;
}
function init() {
var center = new qq.maps.LatLng(39.982163, 116.306070);
var map = new qq.maps.Map(document.getElementById("container"), {
center: center,
zoom: 16
});
//创建一个Marker
var marker = new qq.maps.Marker({
//设置Marker的位置坐标
position: center,
//设置Marker被添加到Map上时的动画效果为落下
animation: qq.maps.MarkerAnimation.DOWN,
//设置Marker被添加到Map上时的动画效果为反复弹跳
//animation:qq.maps.MarkerAnimation.BOUNCE
//设置Marker被添加到Map上时的动画效果为从天而降
//animation:qq.maps.MarkerAnimation.DROP
//设置Marker被添加到Map上时的动画效果为升起
//animation:qq.maps.MarkerAnimation.UP
//设置显示Marker的地图
map: map,
//设置Marker可拖动
draggable: true,
//Marker的覆盖内容
decoration: new qq.maps.MarkerDecoration("标记")
//自定义Marker图标为大头针样式
icon: new qq.maps.MarkerImage(
"https://lbs.qq.com/doc/img/nilt.png"),
//自定义Marker图标的阴影
shadow: new qq.maps.MarkerImage(
"https://lbs.qq.com/doc/img/nilb.png"),
//设置Marker标题,鼠标划过Marker时显示
title: '测试',
//设置Marker的可见性,为true时可见,false时不可见
visible: true,
});
}
设置Marker的属性