XF 2.2 How do I display a widget on desktop only?

click here

Active member
How do I display a widget on desktop only? Do I have to enter something in the "Display condition" option from within the widget?
 

Nicolas FR

Well-known member
You can use media queries in your extra.less template, there is no conditional statement for this AFAIK.
Less:
@media (max-width: 900px) {
    [data-widget-key="you-widget-key"] {
        display: none;
    }
}
 

Mr. Jinx

Well-known member
To detect mobile/desktop, you can use Xon's free add-on:

You can then use this condition to display only on desktops:
Code:
$xf.mobileDetect && !$xf.mobileDetect.isMobile()
 
Last edited:
Top