可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Tried a lot of things
<preference name="fullscreen" value="false" /> <preference name="android-windowSoftInputMode" value="adjustResize" />
This seems to be the prefered methods however my keyboard still show on top of my input.
Should adjustResize force the app window to resize? do I need something else?
How can I stop it from hiding my element in position fixed bottom?
Thanks
回答1:
Try something like this:
Add these piece of code in $(document).ready(function() {}); function in your html page where soft keyboard is appearing.
var initialScreenSize = window.innerHeight; window.addEventListener("resize", function() { if(window.innerHeight < initialScreenSize){ $("#footer").hide(); document.body.style.position = "fixed"; } else{ document.body.style.position = ""; $("#footer").show(); } });
This will might help you.
回答2:
You can detect focused textarea or input then wait a while until keyboard is shown and finally scroll the page to reach focused input. Hope this help you, cheers.
var container = $('body'), scrollTo = $('#textarea'); setTimeout((function() { container.animate({ scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() }); }), 500);