登录页面-防止软键盘弹出所引起的定位问题

This commit is contained in:
gongjin
2018-04-17 14:54:59 +08:00
parent 119dc13488
commit d07c77ebf9
8 changed files with 75 additions and 41 deletions
+1 -1
View File
@@ -149,7 +149,7 @@
</div>
<div id="baseInfo" class="list-block">
<div id="baseInfo" class="list-block mb05">
<base-info-component></base-info-component>
</div>
@@ -15,10 +15,8 @@
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=0a7eM0lkIvpKGPiq1bMCfeH7"></script>
<style>
.list-block ul:before{height:0;}
.priceRecovery + .list-block ul:after{height:0;}
.theme {
background-color: #F18D00;
}
</style>
</head>
@@ -27,7 +25,7 @@
<div class="page-group">
<div class="page page-current">
<header class="bar bar-nav">
<header class="bar bar-nav barBorder">
<button class="button button-link button-nav pull-left" onclick="back(),plus.nativeUI.closeWaiting();">
<span class="icon icon-left"></span>
</button>
@@ -89,7 +87,7 @@
<div class="col-50"><a class="button" v-on:click="feedback(0,$event)">低了</a></div>
</div>
</div>
<div class="list-block media-list">
<div class="list-block media-list mb05">
<ul>
<li>
<div class="item-content">
+16 -13
View File
@@ -12,7 +12,9 @@
<link rel="stylesheet" href="../../css/sm.css">
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../css/theme-orange.css">
<style>
html,body{height:auto;}
</style>
</head>
<body>
@@ -120,18 +122,19 @@ function openView() {
clicked(BASE_PATH + '/user/agreement',true)
}
var originalHeight=document.documentElement.clientHeight || document.body.clientHeight;
window.onresize=function(){
//软键盘弹起与隐藏 都会引起窗口的高度发生变化
var resizeHeight=document.documentElement.clientHeight || document.body.clientHeight;
if(resizeHeight*1<originalHeight*1){ //resizeHeight<originalHeight证明窗口被挤压了
if(window.viewsPage=="codeSms"){
plus.webview.currentWebview().setStyle({
height:originalHeight
});
}
}
}
/* 防止软键盘弹出所引起的定位问题 */
var winHeight = $(window).height(); // 获取当前页面高度
$(window).resize(function(){
var thisHeight = $(this).height();
if(winHeight - thisHeight > 50){
//当软键盘弹出,在这里面操作
$(".loginMode").hide();
}else{
//当软键盘收起,在此处操作
$(".loginMode").show();
}
});
</script>
</body>
+12 -10
View File
@@ -162,17 +162,19 @@ new Vue({
}
});
var originalHeight=document.documentElement.clientHeight || document.body.clientHeight;
window.onresize=function(){
//软键盘弹起与隐藏 都会引起窗口的高度发生变化
var resizeHeight=document.documentElement.clientHeight || document.body.clientHeight;
if(resizeHeight*1<originalHeight*1){ //resizeHeight<originalHeight证明窗口被挤压了
plus.webview.currentWebview().setStyle({
height:originalHeight
});
/* 防止软键盘弹出所引起的定位问题 */
var winHeight = $(window).height(); // 获取当前页面高度
$(window).resize(function(){
var thisHeight = $(this).height();
if(winHeight - thisHeight > 50){
//当软键盘弹出,在这里面操作
$(".loginMode").hide();
}else{
//当软键盘收起,在此处操作
$(".loginMode").show();
}
});
}
}
</script>
</body>