107 lines
3.4 KiB
HTML
107 lines
3.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
|
|
<meta name="HandheldFriendly" content="true"/>
|
|
<meta name="MobileOptimized" content="320"/>
|
|
<title>Hello H5+</title>
|
|
<script type="text/javascript" src="../js/common.js"></script>
|
|
<script type="text/javascript">
|
|
// 预创建二级页面
|
|
var preate={};
|
|
function preateWebivew(id){
|
|
if(!preate[id]){
|
|
var w=plus.webview.create(id,id,{scrollIndicator:'none',scalable:false,popGesture:'hide'},{preate:true});
|
|
preate[id]=w;
|
|
w.addEventListener('close',function(){//页面关闭后可再次打开
|
|
_openw=null;
|
|
preate[id]&&(preate[id]=null);//兼容窗口的关闭
|
|
},false);
|
|
}
|
|
}
|
|
// 判断预载打开
|
|
var _openw=null;
|
|
function pclicked(id){
|
|
if(_openw){return;}
|
|
_openw=preate[id];
|
|
if(_openw){
|
|
if(_openw.showded){
|
|
_openw.show('auto');
|
|
}else{
|
|
_openw.show(as);
|
|
_openw.showded=true;
|
|
}
|
|
_openw=null;
|
|
}else{
|
|
_openw=plus.webview.create(id,id,{scrollIndicator:'none',scalable:false,popGesture:'hide'});
|
|
preate[id]=_openw;
|
|
_openw.addEventListener('loaded',function(){//叶面加载完成后才显示
|
|
// setTimeout(function(){
|
|
_openw.show(as);
|
|
_openw.showded=true;
|
|
_openw=null;
|
|
// },10);
|
|
},false);
|
|
_openw.addEventListener('close',function(){//页面关闭后可再次打开
|
|
_openw=null;
|
|
preate[id]&&(preate[id]=null);//兼容窗口的关闭
|
|
},false);
|
|
}
|
|
}
|
|
// H5 plus事件处理
|
|
var as='pop-in';// 默认动画类型
|
|
function plusReady(){
|
|
// preateWebivew('webview_animation.html');
|
|
// preateWebivew('webview_pullhead.html');
|
|
}
|
|
if(window.plus){
|
|
plusReady();
|
|
}else{
|
|
document.addEventListener('plusready',plusReady,false);
|
|
}
|
|
// 创建悬浮窗口
|
|
var floatw=null;
|
|
function floatWebview(){
|
|
if(floatw){ // 避免快速多次点击创建多个窗口
|
|
return;
|
|
}
|
|
floatw=plus.webview.create("webview_float.html","webview_float.html",{width:'200px',height:'200px',margin:"auto",background:"rgba(0,0,0,0.8)",scrollIndicator:'none',scalable:false,popGesture:'none'});
|
|
floatw.addEventListener("loaded",function(){
|
|
floatw.show('fade-in',300);
|
|
floatw=null;
|
|
},false);
|
|
}
|
|
// 创建自定义下拉刷新窗口
|
|
function customeRefresh(){
|
|
if(plus.os.name!="Android"){
|
|
compatibleConfirm();
|
|
}else{
|
|
clicked('webview_pullhead_custom.html',true,true);
|
|
}
|
|
}
|
|
</script>
|
|
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8"/>
|
|
</head>
|
|
<body>
|
|
<header id="header">
|
|
<div class="nvbt iback" onclick="back()"></div>
|
|
<div class="nvtt">Webview</div>
|
|
<div class="nvbt idoc" onclick="openDoc('Webview Document','/doc/webview.html')"></div>
|
|
</header>
|
|
<div id="dcontent" class="dcontent">
|
|
<br/>
|
|
<div class="button" onclick="pclicked('webview_animation.html',true,true)">窗口动画</div>
|
|
<div class="button" onclick="clicked('webview_embed.html',true)">窗口嵌套</div>
|
|
<div class="button" onclick="floatWebview()">悬浮窗口</div>
|
|
<div class="button" onclick="pclicked('webview_pulltorefresh.html',true,true)">下拉刷新</div>
|
|
<div class="button" onclick="customeRefresh()">自定义下拉刷新</div>
|
|
<div class="button" onclick="clicked('webview_mask.html',true)">窗口遮罩</div>
|
|
<br/>
|
|
</div>
|
|
<div id="output">
|
|
Webview模块管理应用窗口界面,实现多窗口的逻辑控制管理操作。
|
|
</div>
|
|
</body>
|
|
<script type="text/javascript" src="../js/immersed.js" ></script>
|
|
</html> |