mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #264 from matthojo/Login-Cursor
Automatically focus on first login input
This commit is contained in:
commit
6e4755c183
1 changed files with 18 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
// # Temporary Admin UI
|
// # Temporary Admin UI
|
||||||
|
|
||||||
/*global window, document, $ */
|
/*global window, document, _, $ */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -18,14 +19,23 @@
|
||||||
return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
|
return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called on Window resize
|
var positionCenter = _.debounce(function (e) {
|
||||||
$(window).resize(function () {
|
|
||||||
|
|
||||||
var loginContainer = $(".js-login-container"),
|
var loginContainer = $(".js-login-container"),
|
||||||
marginTop = Math.floor((loginContainer.parent().height() - loginContainer.height()) / 2) - 15;
|
marginTop = Math.floor((loginContainer.parent().height() - loginContainer.height()) / 2) - 15;
|
||||||
loginContainer.css('margin-top', marginTop).delay(250).fadeIn(750);
|
loginContainer.animate({'margin-top': marginTop}, 200);
|
||||||
|
$(window).trigger('centered');
|
||||||
|
|
||||||
});
|
}, 100); // Maximum run of once per 100 milliseconds
|
||||||
|
|
||||||
|
function fadeInAndFocus() {
|
||||||
|
$(".js-login-container").fadeIn(750, function () {
|
||||||
|
$("[name='email']").focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).on('resize', positionCenter);
|
||||||
|
$(window).one('centered', fadeInAndFocus);
|
||||||
|
|
||||||
// Allow notifications to be dismissed
|
// Allow notifications to be dismissed
|
||||||
$(document).on('click', '.js-notification .close', function () {
|
$(document).on('click', '.js-notification .close', function () {
|
||||||
|
@ -47,8 +57,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// LOGIN SCREEN
|
// LOGIN SCREEN
|
||||||
|
$(window).trigger('resize');
|
||||||
|
|
||||||
$(window).resize();
|
|
||||||
|
|
||||||
// EDITOR / NOTIFICATIONS
|
// EDITOR / NOTIFICATIONS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue