美文网首页
解诀移动端网页CSS的position: fixed;botto

解诀移动端网页CSS的position: fixed;botto

作者: 肉尔 | 来源:发表于2016-06-28 19:03 被阅读0次

当软键盘弹出时隐藏footer。

js代码如下:

$("body").find("input[type=text]").each(function() {

    $(this).bind('focus', function() {

        $('#footer').css('display', 'none');

    }).bind('blur', function() {

        $('#footer').css({
            'position': 'fixed',
            'bottom': '0'
        });
        var footer = $('#footer');
                    var display = footer.css('display');
                    if (display == 'none') {
                        footer.show();
                    } else {
                        footer.hide();
                    }


    });

});

相关文章

网友评论

      本文标题:解诀移动端网页CSS的position: fixed;botto

      本文链接:https://www.haomeiwen.com/subject/wevtjttx.html