Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.g-recaptcha {
transform-origin: left top;
-webkit-transform-origin: left top;
}
<script>
jQuery(document).ready( function ($) {
"use strict";
function scaleCaptcha( elementWidth ) {
/* Width of the reCAPTCHA element, in pixels */
var reCaptchaWidth = 304;
/* Get the containing element's width */
var containerWidth = $('#frm_field_xxx_container').width();
/* Only scale the reCAPTCHA if it won't fit inside the container */
if(reCaptchaWidth > containerWidth) {
/* Calculate the scale */
var captchaScale = containerWidth / reCaptchaWidth;
/* Apply the transformation */
$('.g-recaptcha').css({ 'transform':'scale('+captchaScale+')' });
}
}
scaleCaptcha();
/* Update scaling on window resize */
$(window).resize( scaleCaptcha() ); });
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.