Hi,我在HBuilder中写了一个横竖屏切换的例子,从竖屏切换到横屏和从横屏切换到竖屏,外面的最大的那个页面能正常显示,但是里面的页面显示位置变了或不在页面上显示了,这是什么原因导致的呢?这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>hello world</title>
<script type="text/javascript" src="js/orientation.js"></script>
<script type="text/javascript">
function helloworld() {
// plus.webview.open("wh.html", "whhhh");
}
document.addEventListener('plusready', function() {
// plus.screen.lockOrientation("portrait-primary");
plus.screen.unlockOrientation();
var webviewObj = plus.webview.create('http://www.baidu.com/', 'baidu', {
'background': '#FF0000',
'width': '100%',
'top': '60px',
'height': '300px'
});
webviewObj.show();
var wetbviewObj2 = plus.webview.create('index_sub.html', 'index_sub', {
'width': '100%',
'height': '50px'
});
wetbviewObj2.show();
});
</script>
</head>
<body>
<button onclick="helloworld() ">
点击进入页面</button>
</body>
</html>
index_sub.html页面代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>hello world</title>
<script type="text/javascript" src="js/orientation.js"></script>
<script type="text/javascript">
function helloworld(){
//plus.webview.open("wh.html", "whhhh");
}
</script>
</head>
<body">
<button onclick="helloworld()">
点击进入页面</button>
</body>
</html>
0 个回复