Mobile app version of vmapp.org
Login or Join
Nimeshi995

: AdSense responsive format resizable on the fly 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

@Nimeshi995

Posted in: #GoogleAdsense #ResponsiveWebdesign

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"):

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

2 Comments

Sorted by latest first Latest Oldest Best

 

@Miguel251

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);
});
});

10% popularity Vote Up Vote Down


 

@BetL925

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme