XF 2.1 Disable widget or customise for mobile view

Kirby12

Member
Hi all.

I've done some searching and can't seem to find what i'm looking for...

Basically i've got a TitanEmbed widget installed in the Forum Overview: Top area. It works fantastically on computer but on mobile it just doesn't do the job, far to small (even though i've set it to scale correctly etc), can literally not even see one full message line.

So my question, is there a way I could potentially get it to either a) work correctly on mobile, by making it taller (more height) or b) just disable it on mobile.

I've attached a couple of screens just so you get a feel for what I mean.

Any help would be greatly appreciated. I'm no wizard with CSS but usually get by with the search function but im struggling to find anything suitable this time.

Thanks

- Kirby
 

Attachments

  • Screenshot 2019-06-28 at 23.23.59.webp
    Screenshot 2019-06-28 at 23.23.59.webp
    15.9 KB · Views: 15
  • image1.webp
    image1.webp
    28.7 KB · Views: 16
Anyone help at all? Im going around in circles with this. Is there a way to make the widget just display in mobile or just display on website? Widget is positioned at Forum Overview: Top.

Thanks
 
Hi all.

posted this in another section but getting desperate now so hoping someone can help me because im literally pulling my hair out at the moment lol.

Basically i've got a TitanEmbed widget installed in the Forum Overview: Top area. It works fantastically on computer but on mobile the padding needs to be more because it is just too small.

So my question, is there a way I could potentially get it to either a) work correctly on mobile, by making the padding higher just for mobile or b) make a widget available on desktop only or mobile only (ill be able to make one suitable for each then)205596

.205597

I've attached a couple of screens just so you get a feel for what I mean.

Any help would be greatly appreciated. I'm no wizard with CSS but usually get by with the search function but im struggling to find anything suitable this time.

Thanks

- Kirby
 
Add this to your extra.less
Less:
@media (max-width: @xf-responsiveWide)
{
    .block[data-widget-key="new_threads_forum_list"] { display: none; }
}

Change new_threads_forum_list to your widget key. You can find the correct key to use when you're editing the widget.
 
Add this to your extra.less
Less:
@media (max-width: @xf-responsiveWide)
{
    .block[data-widget-key="new_threads_forum_list"] { display: none; }
}

Change new_threads_forum_list to your widget key. You can find the correct key to use when you're editing the widget.

205598
205599

added as instructed but it is still displaying on mobile? am i doing something wrong?
 
This is one way you can hide HTML widget on mobile.

Add this to your HTML widget (so wrap your widget content with <span class="test"> ... </span>:
Code:
<span class="test">
< here is your widget template content >
</span>


After that add this to your extra.less template:
Less:
@media (max-width: @xf-responsiveMedium) {
        .test {
            display: none;
    }
}
 
Last edited:
also tried this and no luck. am I using the correct widget ID? see pic above

No you can move your mousecursor to the link to your widget in Widgetsview. (https://www.yourdomain.tld/admin.php?widgets/)

You see something like this
Code:
https://www.yourdomain.tld/admin.php?widgets/suchen-im-netz.11/edit

The ID is here "11" an we use:
Code:
@media (min-width: 650px) {.block[data-widget-id="11"] {display: none;}
 
Last edited:
This is one way you can hide HTML widget on mobile.

Add this to your HTML widget (so wrap your widget content with <span class="test"> ... </span>:
Code:
<span class="test">
< here is your widget template content >
</span>


After that this to your extra.less template:
Less:
@media (max-width: @xf-responsiveMedium) {
        .test {
            display: none;
    }
}
thank you this has worked to disable it for mobile.

is there a way i can now make another widget and have it for MOBILE ONLY. (so i can adjust the padding for the widget to suit mobile screen). what would I have to put in extra.less to disable it for everything except mobile?
 
is there a way i can now make another widget and have it for MOBILE ONLY. (so i can adjust the padding for the widget to suit mobile screen). what would I have to put in extra.less to disable it for everything except mobile?
Yes.

Add this to your new HTML widget (so wrap your widget content with <span class="test2"> ... </span>:
Code:
<span class="test2">
< here is your widget template content >
</span>


After that add this to your extra.less template:
Less:
@media (min-width: @xf-responsiveMedium) {
        .test2 {
            display: none;
    }
}
 
No you can move your mousecursor to the link to your widget in Widgetsview.

You see something like this

The ID is here "11"
thanks here was me thinking its the widget key lol. the option above from @BassMan has successfully removed this widget for mobile now i just need to know how to be able to make another one (which i can increase the padding on) and have it show only for mobile.

if you guys could assist id be very grateful. many thanks
 
Yes.

Add this to your new HTML widget (so wrap your widget content with <span class="test2"> ... </span>:
Code:
<span class="test2">
< here is your widget template content >
</span>


After that add this to your extra.less template:
Less:
@media (min-width: @xf-responsiveMedium) {
        .test2 {
            display: none;
    }
}

Honestly your a hero thank you bud.

and thanks to everyone else too. One happy xenforo user here lol.
 
Top Bottom