Ignore or disable mobile viewport resize due to keyboard open for text inputs on mobile web?

前端 未结 2 1794
北海茫月
北海茫月 2021-01-08 00:15

I\'m using this CSS-only strategy for responsive background images and responsive background image and contained content ... an example of the type of setup I\'m using for b

2条回答
  •  醉话见心
    2021-01-08 00:56

    Usually if you do not use Jquery mobile then you will have to manually fix all the bugs coming with different phone OSs. If you want to skip this library you will have to listen to viewport resize change event and through listening to it get the remaining height and width of the viewport.

    trigger a function according to viewport change like this

    $(window).resize(function() 
    {
    
    });
    

    and inside that get the viewport width height and then adjust the layout accordingly.

    $(window).resize(function() 
    {
    
       var viewportWidth = $(window).width();
    
       var viewportHeight = $(window).height();
    
       //do your layout change here.
    
    });
    

提交回复
热议问题