Skip to content

Instantly share code, notes, and snippets.

@benbai123
Created September 1, 2016 03:51
Show Gist options
  • Save benbai123/ae7f90da8f2ccafde6045aa98a12bb34 to your computer and use it in GitHub Desktop.
Save benbai123/ae7f90da8f2ccafde6045aa98a12bb34 to your computer and use it in GitHub Desktop.
var focuspwTimer, blurpwTimer;
function resetPwTimer () {
clearTimeout(focuspwTimer);
clearTimeout(blurpwTimer);
}
function focusPw () {
resetPwTimer();
focuspwTimer = setTimeout(function () {
if (!$('#pwfocusbox')[0]) {
$('.cd-user-modal')
.append('<div id="pwfocusbox" style="width: 100%; height: 500px;"></div>');
$('.cd-user-modal')[0].scrollTop = 300;
}
}, 200);
}
function blurPw () {
resetPwTimer();
blurpwTimer = setTimeout(function () {
$('#pwfocusbox').remove();
$('.cd-user-modal')[0].scrollTop = 0;
}, 50);
}
$('#cd-login #signin-password')
.on('focus', focusPw)
.on('blur', blurPw);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment