Mui 解决弹出输入法时页面高度变小导致底部上浮的问题

在有输入框的页面,当输入法弹出的时候,底部元素上浮遮盖了输入框,影响页面美观及功能。查找了一下,页面变窄是不可避免的。即使是设置绝对固定也是不可以的。因为webveiw在输入法弹出时候是变化(resize)的。关于document.body.clientheght, screen.height,plus.screen.resolutionHeight的相关区别及联系请查看这

深入理解高度。获取屏幕、webview、软键盘高度
http://www.cnblogs.com/phillyx/
所以要获取屏幕的高度,通过js给一个固定的top

    class="mui-bar mui-bar-tab" id='bottomx'>
            class="mui-tab-item mui-active" href="#tabbar">
                class="mui-icon mui-icon-home">
                class="mui-tab-label">首页
            
            class="mui-tab-item" href="#tabbar-with-chat">
                class="mui-icon mui-icon-email">class="mui-badge">9
                class="mui-tab-label">消息
            
            class="mui-tab-item" href="#tabbar-with-contact">
                class="mui-icon mui-icon-contact">
                class="mui-tab-label">通讯录
            
            class="mui-tab-item" href="#tabbar-with-map">
                class="mui-icon mui-icon-gear">
                class="mui-tab-label">设置
            
        
 mui.plusReady(function() {
                //设置bottom绝对位置
                document.getElementById('bottomx').style.top = (plus.display.resolutionHeight - 50) + "px";
            });

By小云菜:http://www.cnblogs.com/phillyx/

github:http://github.com/phillyx

版权所有,转载请注明出处

 

posted @ 2016-08-30 13:39  乾坤猪猪羊  阅读(616)  评论(0编辑  收藏  举报
欢迎光临乾坤猪猪羊博客园