From 2be4a612ffd36fd2892099bbbac671034594a50e Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Thu, 24 Jan 2013 15:28:07 -0500 Subject: [PATCH] Force spinners to be centered in their enclosing elements This should fix the weird positioning spinners had when they were created while hidden. (imported from commit 777d5c376a3f93b0b7b3b749877070b438b7c102) --- zephyr/static/js/util.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zephyr/static/js/util.js b/zephyr/static/js/util.js index 8f59321605..f9bdbc3527 100644 --- a/zephyr/static/js/util.js +++ b/zephyr/static/js/util.js @@ -43,6 +43,14 @@ exports.make_loading_indicator = function (container, text) { shadow: false }).spin(spinner_elem[0]); container.data("spinner_obj", spinner); + + // Make the spinner appear in the center of its enclosing + // element. spinner.el is a 0x0 div. The parts of the spinner + // are arranged so that they're centered on the upper-left corner + // of spinner.el. So, by setting spinner.el's position to + // relative and top/left to 50%, the center of the spinner will + // be located at the center of spinner_elem. + $(spinner.el).css({left: '50%', top: '50%'}); }; exports.destroy_loading_indicator = function (container) {