2***@qq.com
2***@qq.com
  • 发布:2017-05-17 16:57
  • 更新:2017-05-17 16:57
  • 阅读:1362

为什么marker不显示

分类:HTML5+

官方一模一样的demo,点击添加标点没有任何反应

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Map Example</title>
<script type="text/javascript">
var em=null,map=null;
// H5 plus事件处理
function plusReady(){
// 确保DOM解析完成
if(!em||!window.plus||map){return};
map = new plus.maps.Map("map");
map.centerAndZoom( new plus.maps.Point(116.3977,39.906016), 12 );
}
if(window.plus){
plusReady();
}else{
document.addEventListener("plusready",plusReady,false);
}
// DOMContentloaded事件处理
document.addEventListener("DOMContentLoaded",function(){
em=document.getElementById("map");
plusReady();
},false);
// 添加标点
var marker=null;
function addMarker(){
if(marker){return;}
marker=new plus.maps.Marker(new plus.maps.Point(116.347496,39.970191));
marker.setIcon("/logo.png");
marker.setLabel("HBuilder");
var bubble = new plus.maps.Bubble("打造最好的HTML5移动开发工具");
marker.setBubble(bubble);
map.addOverlay(marker);
}
</script>
<style type="text/css">
#map {
width: 100%;
position: fixed;
top: 100px;
bottom: 0px;
line-height: 200px;
text-align: center;
background: #FFFFFF;
}
</style>
</head>
<body>
向地图中添加覆盖物<br/>
<button onclick="addMarker()">添加标点</button>
<div id="map">地图加载中...</div>
</body>
</html>

2017-05-17 16:57 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复