XF 2.2 Show content for mobile only & pc only

swiftyste

Active member
I'm looking to only show content for mobile only & also show content for pc only

Something similar to this but only by device

Code:
<xf:if is="$xf.visitor.is_admin">
    Show content...
</xf:if>
 
Solution
I manged to get this working by using:

PC Only

Place this anywhere you want the code to work
Code:
<span class="toggle_sidebar">                   
Line of code           
</span>

Place this within extra.less

Code:
@media (max-width: 900px) {
        .toggle_sidebar {
            display: none;
    }
}

Where you see "toggle_sidebar" you can name this what ever you like....

Mobile Only

Place this anywhere you like
Code:
<span class="show_sidebar">                   
Line of code           
</span>

Place this within extra.less

Code:
@media (min-width: 800px) {
        .show_sidebar {
         display: none;   
    }
}
I manged to get this working by using:

PC Only

Place this anywhere you want the code to work
Code:
<span class="toggle_sidebar">                   
Line of code           
</span>

Place this within extra.less

Code:
@media (max-width: 900px) {
        .toggle_sidebar {
            display: none;
    }
}

Where you see "toggle_sidebar" you can name this what ever you like....

Mobile Only

Place this anywhere you like
Code:
<span class="show_sidebar">                   
Line of code           
</span>

Place this within extra.less

Code:
@media (min-width: 800px) {
        .show_sidebar {
         display: none;   
    }
}
 
Solution
Top Bottom