Vertically Center Bootstrap Modals to Fit in Browser Window

Vertically center bootstrap modals without setting a height. Modal max-height will not exceed the window height with scrollable .modal-body and adapts on resize.

You will need these JS and CSS snippets:

 

 

View this on Codepen