学的是android原生的,现在刚实习,公司本意想让新人学习下新技术就把我安排到开发android h5页面去了,虽然之前学过一点h5的知识,但是实际操作起来不如意啊。遇到这个问题时,我不知道怎么做啊,还是度娘吧,整理出了这个解决办法。
<script type="text/javascript">
// 控制手机输入法弹出时,页面不会被顶起
var height = document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = function() {
var heightView = document.documentElement.clientHeight || document.body.clientHeight;
if(heightView < height) {
plus.webview.currentWebview().setStyle({
height: height
});
//修改父页面高度的时候,也要修改子页面的高度 因为子页面距离父页面底部始终是51px 所以这里只需要用父 页面的高度减去51px,就是子页面的高度
plus.webview.getWebviewById('index_aKeyNavigation.html').setStyle({
height: (height * 1 - 51)
});
}
}
</script>