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

XF 1.2 Criteria for notices - using a mobile device/narrow screen width

Stuart Wright

Well-known member
#1
Is this something which would be easy to add?
I want to only display a notification to people not using a mobile device. Or with a narrow width. 800 pixels maybe.
 

Brogan

XenForo moderator
Staff member
#4
The notice should have a CSS class applied to it.
You can use a media query to do display:none for that class below a certain browser width.
For example:
Code:
<xen:if is="@enableResponsive">
    @media (max-width:800px) {
        .noticeClass {
        display: none;
        }
    }
</xen:if>
So if the style is responsive and the browser width is 800px or less, the .noticeClass element won't be displayed.

Or you can use @maxResponsiveWideWidth instead of 800px.
Or you can add one of the predefined classes (at the bottom of the guide) to the HTML.