From ec4361e2f525d6803ef72d37755218db89b925e4 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 16 Oct 2013 15:09:53 -0700 Subject: [PATCH] Dialog: Auto-center dialogs on load and window resize --- ui/scripts/ui/dialog.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index c2077880ec3..4de8423521a 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -15,6 +15,18 @@ // specific language governing permissions and limitations // under the License. (function($, cloudStack, _l) { + $(function() { + $.ui.dialog.prototype.options.autoReposition = true; + $(window).resize(function () { + $(".ui-dialog-content:visible").each(function () { + var dialog = $(this).data("dialog"); + if (dialog.options.autoReposition) { + dialog.option("position", dialog.options.position); + } + }); + }); + }); + cloudStack.dialog = { /** * Error message form