5

The AdSense responsive format sizes the advertising only on load. If the user resizes the window (from large to small), the advertising is not resized (even with media queries) and keeps its initiale size. It seems that we are only allowed to display: none; it.

Is there a way (compliante with the TOS) to resize it dynamically?

If not, is it possible (TOS again) to add overflow: hidden; so that we do not see that (the right border of the parent "box"):

enter image description here

1

You can use jQuery and resize event to reload adsense code after the user resizes the window.

$(window).resize(function(){
   reloadAdsense();
});

In order to prevent a problem with Adsense TOS, make sure it is reloaded with some delay.

$(function() {
    var resize;
    $(window).on('resize', function() {
        clearTimeout(resize);
        resize = setTimeout(function() {
            reloadAdsense();
        }, 300);
    });
});
-1

Yes, it is possible without tos violation: this how-to explains the JQuery-based way.

  • It's always a good idea to add more details to an answer if possible. In this case the link is gone. – Joost Jul 6 '16 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.