$.closeOpened = function(webview) {
var opened = webview.opened();
if (opened) {
for (var i = 0, len = opened.length; i < len; i++) {
var openedWebview = opened[i];
var open_open = openedWebview.opened();
if (open_open && open_open.length > 0) {
$.closeOpened(openedWebview);
} else {
//如果直接孩子节点,就不用关闭了,因为父关闭的时候,会自动关闭子;
if (openedWebview.parent() !== webview) {
openedWebview.close('none');
}
}
}
}
};
$.closeAll = function(webview, aniShow) {
$.closeOpened(webview);
if (aniShow) {
webview.close(aniShow);
} else {
webview.close();
}
};
在调用closeOpened的时候,递归关闭里,$.closeOpened(openedWebview)应该调用closeAll才对,否则如果openedWebview若存在opened()的话,则无法关闭掉自身~
0 个回复