Div element won't stay at the bottom when ios 7 virtual keyboard is present

后端 未结 7 1619
梦毁少年i
梦毁少年i 2020-12-02 05:31

I\'m having a problem with a div element to stick to the bottom of my web app when ios 7 virtual keyboard appears after pressing a textbox.

I\'ve this div element:

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 06:01

    Approved answer works, but can mess with some CSS, so I have to use something else. It's not my fix, but found it on the internet and it worked for me:

    HTML:

    
    

    JavaScript:

    function onResize(){
        var ios7 = (device.platform == 'iOS' && parseInt(device.version) >= 7);
        if (ios7){
            var height = $('body').height();
            if (height < 350){ // adjust this height value conforms to your layout
                $('.myBottomMenu').hide();
            }
            else {
                $('.myBottomMenu').show();
            }
        }
    }
    

提交回复
热议问题