Bootstrap Datepicker appearing at incorrect location in a modal

前端 未结 7 1629
深忆病人
深忆病人 2020-12-29 20:18

I have a button on a page that calls a modal having datepicker.

If this button is at top (I don\'t have to scroll page to click), modal opens and datepicker displays

相关标签:
7条回答
  • 2020-12-29 21:19

    For me below solution is working

    var datepicker = sandbox.dom('body').find('.bootstrap-datetimepicker-widget:last'),
    
    position = datepicker.offset();
    
    // Move datepicker to the exact same place it was but attached to the body
    datepicker.appendTo('body');
    datepicker.css({
        position: 'absolute',
        top: position.top,
        bottom: 'auto',
        left: position.left,
        right: 'auto'
    });
    
    0 讨论(0)
提交回复
热议问题