My Recaptcha challenge popup overflows the viewport on mobile and I'm also unable to scroll the page. I need to always show challenge popup in the center of the viewport (horizontally and vertically). I've looked at Recaptcha API and didn't found how to execute code after challenge popup was rendered. It's rendered with Explicit not automatically.
I've tried:
ReCaptcha v2 causes the issue on smaller (mobile) screens. I managed to work around the issue using CSS.
First scales down the recaptcha container (g-recaptcha in some examples) to take less screen space (optional).
#recaptcha-container
{
transform: scale(0.77);
-webkit-transform: scale(0.77);
transform-origin: 0 0;
-webkit-transform-origin: 0 0;
}
Hide the bubble arrow pointing from the checkbox to the challenge bubble (also optional, but looks nicer IMHO).
.g-recaptcha-bubble-arrow
{
display: none;
}
I believe you're looking for something like the following to find the bubble arrow's sibling div element which contains the iFrame with the challenge and center it on the screen (whatever the size is).
.g-recaptcha-bubble-arrow + div
{
position: fixed !important;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
}
Note that I'm using CSS transform, so check the browser support for your target browser and version. Also note that this works for the current implementation of ReCaptcha, if the HTML output changes in the future a different solution may be necessary.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.