solvable
I am using jQuery focus() and mCustomScrollbar scrollTo
$("#recaptcha_response_field").focus(function() { $(".scroller-back").mCustomScrollbar("scrollTo",this); });
Jsffidle Code
Thus, when the focus (with a click), the recaptcha field automatically scrolls to itself. But this does not work when I use the tab key. I tried with a warning
$('#recaptcha_response_field').focus(function() { alert('Handler for .focus() called.'); });
It works when tab and click, I do not know how jQuery focus() does not work with scrollTo self
Currently:
I am using scrollTo with the send button of the target id.
var a=Recaptcha.$("recaptcha_response_field"); $(a).focus(function() { $(".scroller-back").mCustomScrollbar("scrollTo","#submit_button"); });
Jsffidle Code
rails_id
source share