From 94c8c94ad1e600d1b9084c51157e165cc1a882a7 Mon Sep 17 00:00:00 2001 From: Matthew Harrison-Jones Date: Tue, 11 Jun 2013 18:56:25 +0100 Subject: [PATCH] Fixes login staying centred Now included in `$(window).resize();` to update location of Login container. The login is now more of a visually 'true' centre, with the offset being more towards the top. Centring on resize, wasn't in original commit to remove one extra event listener. --- core/admin/assets/js/admin-ui-temp.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/admin/assets/js/admin-ui-temp.js b/core/admin/assets/js/admin-ui-temp.js index 51a7b4bebe..96fbe84622 100644 --- a/core/admin/assets/js/admin-ui-temp.js +++ b/core/admin/assets/js/admin-ui-temp.js @@ -19,6 +19,14 @@ return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3]; }; + // Called on Window resize + $(window).resize(function () { + + var loginContainer = $(".js-login-container"), + marginTop = Math.round(($(window).height() / 2) - loginContainer.outerHeight()); + loginContainer.css('margin-top', marginTop); + + }); $(document).ready(function () { @@ -33,9 +41,7 @@ // LOGIN SCREEN - var loginContainer = $(".js-login-container"), - marginTop = Math.round(($(window).height() - loginContainer.height()) / 2); - loginContainer.css('margin-top', marginTop); + $(window).resize(); // EDITOR / NOTIFICATIONS