modal-box
modal-box copied to clipboard
keep modal window positioned in the center
Will be good by default to have modal window always positioned to the center. suggested solution will be something like: JS: var width = $(this.container).width(), height = $(this.container).height(); $(this.container).css('margin-left', -(width / 2).toString() + 'px'); $(this.container).css('margin-top', -(height / 2).toString() + 'px');
CSS: .modal-container { position: absolute; top: 50%; left: 50%; }
+1 on this.
Perhaps include it as an option center: true/false
+1