var map = new AMap.Map("container", {
center: [116.343328,39.949901],
zoom: 14,
dragEnable: true
});
2. 给marker增加点击监听事件
var markerCommon = new AMap.Marker({
icon: new AMap.Icon({
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
imageSize: new AMap.Size(18,20) //图标大小
}),
position: new AMap.LngLat(116.343328,39.949901)
});
AMap.event.addListener(markerCommon, 'click', function(e) {
new AMap.InfoWindow({
content:content,
offset: new AMap.Pixel(0, -30)
}).open(map, markerCommon.getPosition());
});