Phonegap JQM修复了关闭android键盘后页眉和页脚移动/隐藏的问题
我已经创建了一个页面,其中我使用了4个可折叠文件。问题是,当我在emulator或mobile中运行应用程序并在关闭键盘后在文本字段中输入内容时,有时页眉和页脚会隐藏,有时它会随着页面一起滑动,在页面上点击后,它会再次出现。我使用的是jQM1.3.1.js文件。谁能告诉我问题是什么,我该如何解决 感谢您的建议。Phonegap JQM修复了关闭android键盘后页眉和页脚移动/隐藏的问题,android,jquery-mobile,header,footer,cordova-2.0.0,Android,Jquery Mobile,Header,Footer,Cordova 2.0.0,我已经创建了一个页面,其中我使用了4个可折叠文件。问题是,当我在emulator或mobile中运行应用程序并在关闭键盘后在文本字段中输入内容时,有时页眉和页脚会隐藏,有时它会随着页面一起滑动,在页面上点击后,它会再次出现。我使用的是jQM1.3.1.js文件。谁能告诉我问题是什么,我该如何解决 感谢您的建议。在jQuery js文件之后和jQuery mobile js文件之前使用这些设置: Use these settings after jQuery js file and before
在jQuery js文件之后和jQuery mobile js文件之前使用这些设置:
Use these settings after jQuery js file and before jQuery mobile js file:
<script>
$(document).on("mobileinit", function () {
$.mobile.fixedtoolbar.prototype.options.tapToggle = false;
$.mobile.fixedtoolbar.prototype.options.hideDuringFocus ="";
});
</script>
$(文档).on(“mobileinit”,函数(){
$.mobile.fixedtoolbar.prototype.options.taptokle=false;
$.mobile.fixedtoolbar.prototype.options.hideDuringFocus=“”;
});
或者,您可以使用页眉标记中的以下内容避免点击时页眉和页脚切换
数据点击toggle=“false”
其他解决方案张贴在这里。这是一条值得一看的线索:
解决这个问题的最简单方法是使用输入焦点和模糊事件 在jQuery中:如果您使用的是html5页脚标记,必要时可以更改为类名
$("input").focus(function(){
$('footer').hide();
});
$("input").blur(function(){
$('footer').show();
});
当我在jquery.js文件之后和JQM.js文件之前编写标记时,它显示无效的文本字符串希望您将其设置为mobileinit事件。对不起,您将这段代码粘贴到哪里?谢谢
// Workaround for buggy header/footer fixed position when virtual keyboard is on/off
$('input, textarea')
.on('focus', function (e) {
$('header, footer').css('position', 'absolute');
})
.on('blur', function (e) {
$('header, footer').css('position', 'fixed');
//force page redraw to fix incorrectly positioned fixed elements
setTimeout( function() {
window.scrollTo( $.mobile.window.scrollLeft(), $.mobile.window.scrollTop() );
}, 20 );
});
$("input").focus(function(){
$('footer').hide();
});
$("input").blur(function(){
$('footer').show();
});