input textbox hidden behind keyboard on android Chrome

后端 未结 7 672
梦毁少年i
梦毁少年i 2020-12-13 13:49

I have a mobile web page of the following format:

header - logo etc - absolute positioned

content - scrollable, absolute positioned

footer, 40px abs

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 14:27

    I'm not smart like you guys,

    So I took a ruler and measured the size of my cell phone screen. 2nd Then measured the size of the keyboard

    I noticed that the keyboard occupied 38% of the screen.

    So I put a div in the footer and called it affectionately frog.

    and I used this code:

     $('body').on('focus', 'input, textarea', function(event) {
            var altura = $(window).height();
            var scrollp = parseInt(parseInt(altura)/100*38);
            $("#divSapo").css("height",scrollp + "px");
            window.scrollTo(0,document.body.scrollHeight);
        });
    

提交回复
热议问题