iOS 11 Safari bootstrap modal text area outside of cursor

前端 未结 14 890
暖寄归人
暖寄归人 2020-11-27 11:22

With iOS 11 safari, input textbox cursor are outside of input textbox. We did not get why it is having this problem. As you can see my focused text box is email text input b

14条回答
  •  感情败类
    2020-11-27 11:59

    This solution worked for me and its working well across all browsers on iOS.

    .safari-nav-force{
    /* Allows content to fill the viewport and go beyond the bottom */
    height: 100%;
    overflow-y: scroll;
    /* To smooth any scrolling behavior */
    -webkit-overflow-scrolling: touch;
    }
    

    JavsScript

    var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
    $('.modal').on('shown.bs.modal', function () {
        if (iOS && $('.modal').hasClass('in')){
            $('html,body').addClass('safari-nav-force');
        }
    });
    $('.modal').on('hidden.bs.modal', function () {
        if (iOS && !$('.modal').hasClass('in')){
            $('html,body').removeClass('safari-nav-force');
        }
    });
    

提交回复
热议问题