android+webview+打不开,webview 在android下无法打开 ?是否为一个bug?请帮忙看下!谢谢!...

android 平台上(已经试过 nexus 5 , samsung s6等三个机型),如果先点击右边的图标打开预加载好的webview, 顺利滑出;但是不管之后还是之前,如果打开过左边的webview(drawer 效果)之后,再点击右边图标想打开右边的webview,就完全打不开,主窗口也没有移动,只出现了一个半透明的mask,但是 左边的窗口和drawer效果,毫无影响,从头到尾都可以顺利弹出。请帮我看看是什么问题?代码见下:

var leftDrawer=null,rightDrawer=null,rootWindow=null;

var leftDrawerStatus=false, rightDrawerStatus=false;

var isLeftInTransition=false,isRightInTransition=false;

mui.plusReady(function(){

plus.screen.lockOrientation('portrait-primary');

rootWindow=plus.webview.currentWebview();

rootWindow.addEventListener('maskClick',function(){

if(leftDrawerStatus){

closeLeftDrawer();

}

else{

closeRightDrawer();

}

});

setTimeout(function(){

leftDrawer=mui.preload({

id:'leftDrawer',

url:'leftDrawer.html',

styles:{

left:0,

top:0,

width:'70%',

zindex:-1

},

show:{

aniShow:'none'

}

});

rightDrawer=mui.preload({

id:'rightDrawer',

url:'rightDrawer.html',

styles:{

right:0,

top:0,

width:'70%',

zindex:-1

},

show:{

aniShow:'none'

}

});

},200);

function openLeftDrawer(){

if(isLeftInTransition){

return ;

}

if(!leftDrawerStatus){

isLeftIntransition=true;

leftDrawer.setStyle({

mask: 'rgba(0,0,0,0)'

});

leftDrawer.show('none', 0, function() {

rootWindow.setStyle({

mask: 'rgba(0,0,0,0.4)',

left: '70%',

transition: {

duration: 150

}

});

mui.later(function() {

isLeftInTransition = false;

leftDrawer.setStyle({

mask: "none"

});

}, 160);

leftDrawerStatus = true;

});

}

};

function openRightDrawer(){

if(isRightInTransition){

return ;

}

if(!rightDrawerStatus){

isRightInTransition=true;

rightDrawer.setStyle({

mask: 'rgba(0,0,0,0)'

});

rightDrawer.show('none', 0, function() {

rootWindow.setStyle({

mask: 'rgba(0,0,0,0.4)',

right: '70%',

transition: {

duration: 150

}

});

mui.later(function() {

isRightInTransition = false;

rightDrawer.setStyle({

mask: "none"

});

}, 160);

rightDrawerStatus = true;

});

}

};

function closeLeftDrawer() {

if (isLeftInTransition) {

return;

}

if (leftDrawerStatus) {

isLeftInTransition = true;

rootWindow.setStyle({

mask: 'none',

left: 0,

transition: {

duration: 200

}

});

leftDrawerStatus = false;

mui.later(function() {

isLeftInTransition = false;

leftDrawer.hide();

}, 300);

}

};

function closeRightDrawer() {

if (isRightInTransition) {

return;

}

if (rightDrawerStatus) {

isRightInTransition = true;

rootWindow.setStyle({

mask: 'none',

right: 0,

transition: {

duration: 200

}

});

rightDrawerStatus = false;

mui.later(function() {

isRightInTransition = false;

rightDrawer.hide();

}, 300);

}

};

document.querySelector('#leftDrawer').addEventListener('tap',function(e){

if(leftDrawerStatus){

closeLeftDrawer();

}

else{

openLeftDrawer();

}

});

document.querySelector('#rightDrawer').addEventListener('tap',function(e){

if(rightDrawerStatus){

closeRightDrawer();

}

else{

openRightDrawer();

}

});

});

感谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值