javascript - How to determine the hidden buttons of the mobile soft keyboard
三叔
三叔 2017-06-28 09:27:03
0
3
837

is the down arrow that closes the keyboard

Suddenly discovered that alert(keyCode)
This button has no code on android

How to deal with it

How to judge Closed

三叔
三叔

reply all(3)
仅有的幸福

Tongzhun, I encountered this problem a long time ago, but I haven’t found a more complete answer

世界只因有你

When the user calls out the soft keyboard, the page will trigger the resize event, and the page size will become smaller. The height is only the original height minus the keyboard height, which is generally less than 500. At the same time, there are almost no screens on the market with the original height less than 500. Mobile phone, so after resize is triggered, it is judged that if document.body.clientHeight>500
, the soft keyboard is regarded as being closed

There should be compatibility issues. . . . . . . . . . . . . .

Peter_Zhu

android can listen to resize events

var winHeight= $(window).height();
    $(window).resize(function(){
        var thisHeight=$(this).height();
        if(winHeight - thisHeight >50){
            $('.form_scrollTxt').hide();
            $('.form p').css('margin-bottom','2px')
        }else{
            $('.form_scrollTxt').show();
            $('.form p').css('margin-bottom','13px')
        }
    });
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!