• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 How to hide a block of ads from mobile users

#1
I wonder if there is a conditional that would let me hide certain parts from mobile users or just something that would hide a block when the screen resolution is less then xxx.

I have two ad banners side by side and I dont want the one on the right to show up when someone loads a page on a mobile phone.

I would appreciate if someone could point me in the right direction.
 

AndyB

Well-known member
#3
1) In the template that contains your banner, add a div surrounding it like this:

Code:
<div class="my_responsive_add">
your banner
</div>
2) Add this to your EXTRA.css template.

Code:
.my_responsive_add {
  display:inline;
}

@media (max-width:@maxResponsiveWideWidth){
  .my_responsive_add {
  display:none;
  }
}
 

Robby

Well-known member
#5
1) In the template that contains your banner, add a div surrounding it like this:

Code:
<div class="my_responsive_add">
your banner
</div>
2) Add this to your EXTRA.css template.

Code:
.my_responsive_add {
  display:inline;
}

@media (max-width:@maxResponsiveWideWidth){
  .my_responsive_add {
  display:none;
  }
}
This works very good.
Don't i need to fill in the wide because now there is just @maxResponsiveWideWidth?
Is this still good voor xenforo 1.3?