Issue with bootstrap-modal-bs3patch.css library and Bootbox
I have been trying work with Bootbox and modals at the same time, but when I load "bootstrap-modal-bs3patch.css" library in the same file the Bootbox dialog appears weird, see the next screen
Could you please help me with it?
Sorry, but I suspect using two libraries which augment Bootstrap's basic modals is always going to result in a conflict of some sort. In this case, the external CSS from another third party library (https://github.com/jschr/bootstrap-modal) is causing otherwise standard modals to appear incorrectly - I'd suggest raising a ticket on that project if needs be :).
I fixed this conflict by adding this line after the .modal in the bootstrap-modal-bs3patch.css.
.modal.bootbox {
border: none;
background: none;
box-shadow: none;
}
menacestudio's solution didn't work for me, so instead I came up with this (very hacky) fix:
I renamed .modal to .modal-fix in bootstrap-modal-bs3patch.css, then added this to the init method in modal.js:
if (!this.$element.hasClass('bootbox')) {
this.$element.addClass('modal-fix');
}
Modals and Bootbox are now working beautifully together :)
@markormesher your hack worked.
But i also needed to adjust the backdrop z-index
baseIndex['backdrop'] = baseIndex['backdrop'] - 1;
@markormesher Thank you very much...
Worked like a charm - thank you @markormesher and @ThaDafinser both. Just an addition for those who may be wanting to know where to add @ThaDafinser's change - it has to be added inside bootstrap-modalmanager.js, in the getzIndex function.
I just had to use @menacestudio solution with one additional css
.modal.bootbox .modal-dialog
{
width:auto;
}
because otherwise it will conflict with bootstrap rules for max width of modals.
@makeusabrew it worked perfectly! Thank you!!!
@markormesher Thanks!
Thanks you all!
@markormesher Thanks!
Thanks @menacestudio & @RokSiEu :+1:
Thank you very much! Your solution works beautiful! @markormesher
Not Working
Bootbox doesn't have it's own stylesheet. If loading another library causes issues with Bootbox modals, you need to take that up with that library.
Locking this.