Center modal view on show

This commit is contained in:
Jonathan Frederic 2013-11-25 14:50:23 -08:00 committed by Jonathan Frederic
parent 2d536f64f5
commit 8b08e1c53c

View File

@ -120,9 +120,10 @@ define(["notebook/js/widget"], function(widget_manager) {
show: function() {
this.$window.show();
this.$show_button.addClass('btn-info');
var position = this.$show_button.offset();
this.$window.css('left', position.left + this.$show_button.outerWidth());
this.$window.css('top', position.top);
this.$window.css("top", Math.max(0, (($(window).height() - this.$window.outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.$window.css("left", Math.max(0, (($(window).width() - this.$window.outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
},
update: function(){