A jQuery solution, considering the modal-dialog is position absolute/relative/fixed:
var windowHeight = $(window).height();
var windowWidth = $(window).width();
var boxHeight = $('.modal-dialog').height();
var boxWidth = $('.modal-dialog').width();
$('.modal-dialog').css({'left' : ((windowWidth - boxWidth)/2), 'top' : ((windowHeight - boxHeight)/2)});
A jQuery solution, considering the modal-dialog it's not position absolute/relative/fixed:
css:
margin-left: auto;
margin-right: auto;
jquery:
var windowHeight = $(window).height();
var boxHeight = $('.modal-dialog').height();
$('.modal-dialog').css({'margin-top' : ((windowHeight - boxHeight )/2)});