Skip to content

Instantly share code, notes, and snippets.

@mahbubur001
Created November 13, 2019 04:42
Show Gist options
  • Select an option

  • Save mahbubur001/8ec5ea065bb1fcb0e14dbed1a1e8177b to your computer and use it in GitHub Desktop.

Select an option

Save mahbubur001/8ec5ea065bb1fcb0e14dbed1a1e8177b to your computer and use it in GitHub Desktop.

Revisions

  1. mahbubur001 created this gist Nov 13, 2019.
    24 changes: 24 additions & 0 deletions reCAPTCHA-responsive-scaling.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    (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);