测试手机上面可以显示,不过发布后不显示,代码如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>便民交通</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
<style type="text/css">
.content{
width:100%;
position: fixed;
top: 40px;
bottom: 0px;
line-height: 200px;
text-align: center;
background: #FFFFFF;}
.scontent{width: 100%;position: fixed;top: "+ptop+"px;bottom: "+pbottom+"px;text-align: center;overflow-y: scroll;-webkit-overflow-scrolling: touch;-ms-touch-action: pan-y cross-slide-y;-ms-scroll-chaining: none;-ms-scroll-limit: 0 50 0 50;}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-icon mui-icon-arrowleft mui-pull-left" onclick="back(true)" title="返回"></a>
<h1 class="mui-title">实况路线</h1>
</header>
<div id="content" class="content">地图加载中...</div>
</body>
<script type="text/javascript">
var em=null,map=null;
// H5 plus事件处理
function pulcR(){
map = new plus.maps.Map("content");
map.getUserLocation(locationCallback);
map.showUserLocation( true );
map.setTraffic( true );
plus.key.addEventListener('backbutton', function()
{
back(true);
}, false);
}
if(window.plus){
pulcR();
}else{
document.addEventListener("plusready",pulcR,false);
}
// 通知结果方法
function locationCallback( state, point ) {
if ( 0 == state ) {
map.centerAndZoom( new plus.maps.Point(point.getLng(),point.getLat()), 15);
} else {
alert( "无法获取当前位置" );
}
}
function back(hide)
{
if(window.plus)
{
var ws = plus.webview.currentWebview();
if(hide || ws.preate)
ws.hide('auto');
else
ws.close('auto');
}
else if(history.length > 1)
history.back();
else
w.close();
}
</script>
</html>
1 个回复
littlebear
百度的配置都搞了吗