JQuery mCustomScrollbar autoScrollOnFocus
Solved
I'm using focus()
function and mCustomScrollbar function scrollTo
$("#recaptcha_response_field").focus(function() {
$(".scroller-back").mCustomScrollbar("scrollTo",this);
});
Code on Jsffidle
When the cursor has focus on recaptcha text field, the scroll will scrolling to on a line with recaptcha text field (scroll to self). But it's doesn't work when we use the tab key. I have tried with alert
$('#recaptcha_response_field').focus(function() {
alert('Handler for .focus() called.');
});
Updated
I'm using scrollTo with target id's submit button.
var a=Recaptcha.$("recaptcha_response_field");
$(a).focus(function() {
$(".scroller-back").mCustomScrollbar("scrollTo","#submit_button");
});
Code on Jsffidle