Make Google reCaptcha responsive


This tutorial aims to explain how to do to make the ReCaptcha security code from Google responsive. Indeed, by default, the robot checking module is not "responsive", that is to say that its dimensions do not adapt to his surroundings.

var width = $('.g-recaptcha').parent().width();
if (width < 302) {
	var scale = width / 302;
	$('.g-recaptcha').css('transform', 'scale(' + scale + ')');
	$('.g-recaptcha').css('-webkit-transform', 'scale(' + scale + ')');
	$('.g-recaptcha').css('transform-origin', '0 0');
	$('.g-recaptcha').css('-webkit-transform-origin', '0 0');
}