iPad上的Twitter引导模式问题

iPad上的Twitter引导模式问题,ipad,twitter-bootstrap,modal-dialog,Ipad,Twitter Bootstrap,Modal Dialog,我对iPad上的引导模式有一些问题 我在Bootstap模式中有一个表单。当我点击下拉输入时,虚拟键盘出现,它在页面重叠处剪切/剪辑页面。然后,当您向上滑动页面以查看更多内容时,页面不会进一步滚动。这个问题在横向的iPad中更为明显 有人有过这个问题并克服了吗 这里有一个.对于任何遇到这个问题的任性灵魂(像我一样),@Dan的github引用有解决这个问题的方法 一位开发人员(ridjohansen)建议使用: if( navigator.userAgent.match(/iPhone|iPad

我对iPad上的引导模式有一些问题

我在Bootstap模式中有一个表单。当我点击下拉输入时,虚拟键盘出现,它在页面重叠处剪切/剪辑页面。然后,当您向上滑动页面以查看更多内容时,页面不会进一步滚动。这个问题在横向的iPad中更为明显

有人有过这个问题并克服了吗


这里有一个.

对于任何遇到这个问题的任性灵魂(像我一样),@Dan的github引用有解决这个问题的方法

一位开发人员(ridjohansen)建议使用:

if( navigator.userAgent.match(/iPhone|iPad|iPod/i) ) {

$('.modal').on('show.bs.modal', function() {

    // Position modal absolute and bump it down to the scrollPosition
    $(this)
    .css({
        position: 'absolute',
        marginTop: $(window).scrollTop() + 'px',
        bottom: 'auto'
    });

    // Position backdrop absolute and make it span the entire page
    //
    // Also dirty, but we need to tap into the backdrop after Boostrap 
    // positions it but before transitions finish.
    //
    setTimeout( function() {
    $('.modal-backdrop').css({
        position: 'absolute', 
        top: 0, 
        left: 0,
        width: '100%',
        height: Math.max(
        document.body.scrollHeight, document.documentElement.scrollHeight,
        document.body.offsetHeight, document.documentElement.offsetHeight,
        document.body.clientHeight, document.documentElement.clientHeight
        ) + 'px'
    });
    }, 0);
});
}
虽然有点难看,但它确实有效。我稍微修改了一下,将代码放在document.ready中,并将“if navigator…”语句放在modal的on函数中,仅当用户的浏览器正在运行时才会触发此代码

只是想分享一下万一这段git对话消失了

$(document).on('blur', 'input, textarea', function () { setTimeout(function () { window.scrollTo(document.body.scrollLeft, document.body.scrollTop); }, 0); });

上面的代码帮助我修复它

参考: