老师,帮忙查看下我的图标是爱心形状,为啥不出来
来源:5-2 自定义点标记图标
weixin_慕设计6449438
2019-06-06 16:54:00
3回答
同学你好,建议:可以直接将代码粘贴过来,便于准确的定位与解决问题。
祝学习愉快!
好帮手慕糖
2019-06-07
同学你好,如下,缺少一个new哦。
希望能帮助到你,欢迎采纳。
祝学习愉快!
weixin_慕设计6449438
提问者
2019-06-06
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#container {width:800px; height: 800px; margin:0 auto; z-index:1; position:relative;}
</style>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.14&key=3a298a1ee7f05d8312a666dbcdf33fb2"></script>
</head>
<body>
<div id="container">
</div>
<script type="text/javascript">
var mymap= new AMap.Map('container',{
center:[112.951517,28.184407]
});
//自定义标记图标
var mar=AMap.Icon({
size: new AMap.Size(200,200), //图片本身的大小
image:'./love.png', //图片来源
imageSize:new AMap.Size(25,25)
});
var marker=new AMap.Marker({
position:[112.951517,28.184407],
icon:mar,
// offset:new AMap.Pixel(-5,-0)
});
mymap.add( [marker]);
</script>
</body>
</html>
相似问题