Created
November 13, 2019 04:42
-
-
Save mahbubur001/8ec5ea065bb1fcb0e14dbed1a1e8177b to your computer and use it in GitHub Desktop.
reCAPTCHA Responsive Scaling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
function scaleCaptcha() { | |
$('.ginput_container.ginput_recaptcha').each(function () { | |
var self = $(this), | |
width = $(this).parent().width(); | |
if (width < 302) { | |
var scale = width / 302; | |
self.css('transform', 'scale(' + scale + ')'); | |
self.css('-webkit-transform', 'scale(' + scale + ')'); | |
self.css('transform-origin', '0 0'); | |
self.css('-webkit-transform-origin', '0 0'); | |
} | |
}); | |
} | |
// Initialize scaling | |
scaleCaptcha(); | |
// Update scaling on window resize | |
// Uses jQuery throttle plugin to limit strain on the browser | |
$(window).resize($.throttle(100, scaleCaptcha)); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment