The html5 Android soft keyboard pops up and squeezes the screen space to move the positioning element up

When you click the input box and the soft keyboard pops up, the small keyboard under the Android machine will occupy the screen space, causing the content to move up and cause the content to be dislocated. The solution can be to monitor the page resize event, because the pop-up of the keyboard under Android will cause the page to resize.

For example, a text link "Login Now" needs to be positioned at the bottom of the registration page. When the soft keyboard pops up, the text link will move up and overlap with the above content. You can listen to the resize event. When the screen becomes smaller, it indicates that the soft keyboard pops up and is hidden at this time. text chain, otherwise, display the text chain

Code:

    var h = $(window).height();
    $(window).resize(function() {
    	if($(window).height()<h){
    		$('.zc-opr').css("display","none");
    	}else{
    		$('.zc-opr').css("display","block");
    	}
    });

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326440530&siteId=291194637