Commit 68e6ca91 authored by hbcui1984's avatar hbcui1984

侧滑菜单隐藏时,将web view置为hidden状态;

parent 4ebed9a1
......@@ -122,7 +122,8 @@
if (slideTogether) {
left = '-70%';
}
menu = mui.openWindow({
//侧滑菜单默认隐藏,这样可以节省内存;
menu = mui.preload({
id: 'offcanvas-plus-menu',
url: 'offcanvas-plus-menu.html',
styles: {
......@@ -143,6 +144,17 @@
});
});
document.querySelector('.mui-icon-bars').addEventListener('tap', function() {
//控制侧滑菜单webview的显示、隐藏;
if(showMenu){
//侧滑菜单已显示,则等主窗体移动完毕后,再隐藏自己;
setTimeout(function () {
menu.hide();
},300);
}else{
//侧滑菜单处于隐藏状态,则立即显示出来;
menu.show();
}
//主窗体开始侧滑;
mui.currentWebview.setStyle({
left: showMenu ? '0' : '70%',
transition: {
......
......@@ -120,7 +120,7 @@
if(slideTogether){
left = '100%';
}
menu = mui.openWindow({
menu = mui.preload({
id: 'offcanvas-plus-menu',
url: 'offcanvas-plus-menu.html',
styles: {
......@@ -148,6 +148,18 @@
document.querySelector(".mui-bar-nav~.mui-content").style.paddingTop = content_padding;
}
//控制侧滑菜单webview的显示、隐藏;
if(showMenu){
//侧滑菜单已显示,则等主窗体移动完毕后,再隐藏自己;
setTimeout(function () {
menu.hide();
},300);
}else{
//侧滑菜单处于隐藏状态,则立即显示出来;
menu.show();
}
//主窗体开始移动
mui.currentWebview.setStyle({
left: showMenu ? '0' : '-70%',
transition: {
......
......@@ -490,11 +490,22 @@
popGesture:"hide"
}
});
var template = plus.webview.create('examples/template.html', 'demoTemplate',{popGesture:"hide"});
var subWebview = plus.webview.create('examples/accordion.html', 'template_sub', {
top: '48px',
bottom: '0px'
//预加载共用父webview
var template = $.preload({
url:'examples/template.html',
id:'demoTemplate',
styles:{
popGesture:"hide"
}
});
////预加载共用子webview
var subWebview = $.preload({
url:'examples/accordion.html',
id:'template_sub',
styles:{
top: '48px',
bottom: '0px'
}
});
var waiting = null;
subWebview.addEventListener('loaded', function() {
......@@ -502,8 +513,15 @@
subWebview.show();
},50);
});
subWebview.hide();
//iOS平台支持侧滑关闭,父窗体侧滑隐藏后,同时需要隐藏子窗体;
if($.os.ios){
template.addEventListener('hide',function () {
subWebview.hide("none");
});
}
template.append(subWebview);
if ($.os.android) {
......@@ -554,10 +572,6 @@
if(subWebview.getURL()==this.href){
subWebview.show();
}else{
//为了适应ios的侧滑关闭,需要手动隐藏;
if ($.os.ios){
subWebview.hide("none");
}
subWebview.loadURL(this.href);
}
template.show('slide-in-right', 150);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment