• 保存到桌面  加入收藏  设为首页
HTML5

js-动态检测手机虚拟按键隐藏显示-华为-监听虚拟按键

时间:2017-11-24 20:34:29   作者:江节胜   来源:胜行天下网   阅读:1848   评论:0
底部固定布局设置一个div position:absolute,bottom:0px
<!--用于监听底部虚拟按键开启和关闭-->
<div id="idFixedButtom" style="background-color: red; position: absolute;bottom: 0px;width: 100%;height:1px;">
</div>
<!--用于监听底部虚拟按键开启和关闭-->

mui-scroll-wrapper 好像还是要设置默认的绝对布局 style="position: absolute;

window.onresize = function() {
    resizeScrollHeight();
}

function resizeScrollHeight() {
/**
* 子webview环境中,不需要考虑标题栏高度
*/
    var partHeader = findID('partHeader');
    var partHeaderHeight = partHeader.offsetHeight;
    var clientHeight = window.screen.availHeight;//考虑到兼容性,只用这个获取屏幕高度
    var idFixedButtom = findID('idFixedButtom');
    var buttomTop = idFixedButtom.offsetTop;
    var buttomHeight = idFixedButtom.offsetHeight;
    clientHeight = buttomTop;//核心这里灵活取高度值
    var scrollHeight = clientHeight -buttomHeight;//在子webview环境中,不需要考虑标题栏高度
    console.log('滚动区域 高度 计算 =' + scrollHeight);
    var partScroll = findID('partScroll');
    partScroll.style.height = scrollHeight +"px"; //必须加px ---> 显示页面中间核心内容高度
}


有任何疑问或技术合作都可联系我

微信:yanfahezuo 【推荐】

QQ:596957738


相关评论

加我微信 596957738 (QQ同号)加我微信     QQ联系:596957738    地址:江苏省南京市浦口区

苏ICP备2023050353号

   

苏公网安备32011402010305号

江节胜的Gitee,江节胜的Git地址