We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

Hiding Adsense on Mobile Devices

270 Views
Last Modified: 2017-03-19
In a Joomla module I am trying to not show some Adsense ads when the screen resolution is below 350px.  Here is the code I have tried:

<style type="text/css">
.responsive_right_1 { display:inline-block; width: 320px; height: 100px; }
@media (max-width: 350px) { .responsive_right_1  { display: none; } }
@media (min-width: 500px) { .responsive_right_1  { width: 320px; height: 100px; } }
@media (min-width: 900px) { .responsive_right_1  { width: 336px; height: 280px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive_right_1 -->
<ins class="adsbygoogle responsive_right_1"
     style="display:inline-block"
     data-ad-client="ca-pub-xxxxxxxxxxxxxx"
     data-ad-slot="xxxxxxxxxxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Open in new window


However, the ads still appear when the screen resolution is set to 350px or lower.
Comment
Watch Question

Developer
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2013
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks.  With a few additional changes I was able to make this work.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.