1.html page (if the effect does not come out, note modify single quotation marks)
<! DOCTYPE html>2. Modify Bootstrap.js Source code
Open bootstrap.js ctrl+f find modal corresponding code
Modal.prototype.adjustDialog = function () { var modalisoverflowing = this. $element [0].scrollheight > Document.documentElement.clientHeight this . $element. css ({ paddingleft: !this.bodyisoverflowing && modalisoverflowing? This.scrollbarwidth: " paddingRight:this.bodyIsOverflowing &&!modalisoverflowing?" This.scrollbarwidth: " }) //Add the following three lines of code, note to modify single quotation marks! var $modal _dialog = $ (this. $element [0]). Find ('. Modal-dialog '); var m_top = ($ (document). Height ()-$modal _dialog.height ())/2; $modal _dialog.css ({' margin ': M_top + ' px Auto '});
This is the way to achieve modal vertical center!
Bootstrap pop-up box centered