1. 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

Discussion in 'Styling and Customization Questions' started by Parminder Singh Chahal, Aug 28, 2013.

  1. Parminder Singh Chahal

    Parminder Singh Chahal Active Member

    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.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. AndyB

    AndyB Well-Known Member

    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;
      }
    }
    
     
    DFI, nttruong, Breixo and 3 others like this.
  4. Parminder Singh Chahal

    Parminder Singh Chahal Active Member

    My grey cells are refusing to cooperate today. I will try this some other time.
     
  5. Robby

    Robby Well-Known Member

    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?
     
  6. DFI

    DFI Active Member

    Is it possible Not to Display some of the many Adsense ads on Mobile Browser ?
     

Share This Page