Demo
For some reason, it removes my modal-open class from the body, and that scrollbar disappears. So here is a neat trick to capture the .modal closing .modal and check if any .modal , and if so, add the .modal-open class to the body
$("#myModal2").on('hidden.bs.modal', function (event) { if ($('.modal:visible').length) //check if any modal is open { $('body').addClass('modal-open');//add class to body } });
Now, if you have several modals nested within each other, just replace $("#myModal2") with $(document)
UPDATE
Recently, I found out that this can be done using pure CSS with only a string, as shown below:
.modal{ overflow:auto !important; }
UPDATED DEMO
source share